All about Git – “Git Stash” Part – II
In this post, I am going to discuss on a very powerful command “git stash”. It is a very powerful command and that is why I want to dedicate a single blogpost discussing only about this important command.WHAT IS GIT STASH:This command will temporarily shelve the changes you’ve made to your working copy so that you can work o something else, and then come back and re-apply those changes at later point in time.HOW TO STASH YOUR WORK:The command git stash takes the uncommitted changes (both staged and unstaged) and saves them away for later use, thus reverting them from your working copy.For example, I have two files “test.txt” and “NewOne.txt”. Out of these two files, “test.txt” is staged and ready to be committed whereas the file “NewOne.txt” is yet to be staged.So if I issue the command git status, below is the result -Now if I issue the command git stash, let’s see what happens -So if I open the file, I will notice that all my changes to these two files are gone. But where? How can I get those changes back? So many questions!! 🙂 I will come into each of these questions slowly.One important point to tell here is that stash is local to your Git repository; stashes are not transferred to the server when you push.HOW TO RE-APPLY THE STASHED CHANGES:One can re-apply the stashed...
Read More