Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stash uncommitted changes in Visual Studio 2013

Need some help on how I can shelve uncommited changes in a Git repository using Visual Studio 2013. I come from PHPStorm where you can shelve uncommited changes on one branch, switch to another and unshelve.

However, I can't find/see how this can be done in Visual Studio. Could someone shed some light on this issue?

Just to clarify why this may be needed: I might be working on branch X, and then figure that I am the wrong branch and I should be on branch Y. I need to shelve all changes from branch X, switch to branch Y, unshelve changes and then commit.

Thanks.

like image 518
teh0wner Avatar asked Oct 27 '13 12:10

teh0wner


People also ask

What is the command to store the uncommitted changes temporarily in git?

The "git stash" command can help you to (temporarily but safely) store your uncommitted local changes - and leave you with a clean working copy.


1 Answers

In git the concept you're looking for is stash. You add your changes as if you are going to commit them, and you then stash them with git stash. After changing branches, you can git stash apply or git stash pop (with the former leaving the stash available for reuse).

I'm familiar with the shelf concept from Perforce, which has a useful difference from Git's stash -- where you can send a shelf to the server and share it with other people, you cannot do that with git. However, with git you can just create a branch with the stash and push that to the server, allowing others to merge it where it's needed.

Microsoft does not provide a way to use this feature.

like image 157
mah Avatar answered Sep 27 '22 19:09

mah