Stashing your changes
Git has a command that allows you to save the current state of the local working repository and go back to the last committed revision with git stash
.
This is really helpful when you have to develop an urgent fix. After this, you can restore the stashed changes and continue with your development.
To use this command, just execute the following command snippet:
Erik@server:~$ git stash #Do your fix and then unstash edit Erik@server:~$ git stash pop
Of course, you can do more with this command, such as save a list of stashes:
Erik@server:~$ git stash #See the list of available stashes Erik@server:~$ git stash list #Apply the second stash Erik@server:~$ git stash apply stash@"1} #Delete a stash Erik@server:~$ git stash drop stash@"1} #Or delete all stashes Erik@server:~$ git stash clear
Let's suppose that your stash concerns a feature and you haven't created a dedicated branch for it. You can simply create a branch executing this command:
Erik@server:~...