Hi! I'm Nathan Hoad


How to: Git stash

You are busy programming away in the middle of a task and suddenly something urgent comes up. If you are awesome enough to be a Git user then you needn't fret, just use git stash.

git stash

(Note: untracked files are ignored by stash)

The stash command in Git is kind of like a clipboard; you can stash away any changes in your current branch to work on something else for a while. You can change branches and perform other commits. When you are ready to continue working on those changes simply change back to the branch that the stash came from and run git stash apply.

git stash apply

If you want to clean out your stash (multiple stashes can be stored) then run git stash clear but be careful not to clear out your stashes if you have any that you need to apply first

Check out the git-stash documentation for more information.

If I just made your day a little better then thank me with a coffee or maybe a a pizza