Git Stash : A very useful command

31 / Aug / 2010 by Vivek Krishna 0 comments

We have been using GitHub for version control in one of our projects and I am absolutely loving it! There are quite many advantages over a concurrent version control system like subversion.

One of the commands I found useful was the stash command. It is of use when we are working on a piece of functionality, which is not in a state to be committed, but find that there is a bug/issue in a previously committed piece of code and want to fix it before proceeding with any further development.

In that case, what we can do is issue the command

git stash save "work in progress"

Once that is done, it is a save point. Now you can revert the code for that particular branch by using the checkout command.
After fixing the issue and committing it (and pushing it) we can get back the copy on which we were working, with the command,

git stash pop

A very elegant command in what would’ve been an otherwise tedious job,

Hope this helps.

Vivek

FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *