Git Stash

With git stash you can forget for a moment about the updates you’re currently working on to focus on something else.

Use git stash to save the current state of your work.

1
$ git stash save "work in progress"

This command will stash your changes, and reset working tree and index to match the tip of your current branch.

Now you can focus on something else, fix a bug, write a test, etc.

1
$ git commit -a -m "Fix typo"

After that, you can go back to what you were working on with git stash apply:

1
$ git stash apply

Stashed updates are queued, if you run git stash list you can see the queue of changes.

1
2
3
$ git stash list
stash@{0}: WIP on develop: 51bea1d Update license
stash@{1}: WIP on master: 9705ae6 Fix images

Then you can apply them individually with git stash apply stash@{1}.

You can clear out the list with git stash clear.

Source: Git Community Book - Stashing

Next: Fix git commit message