Git Stash

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

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

$ git stash save "work in progress"

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

Then handle the unexpected event, fix bugs, update code, write tests.

$ git commit -a -m "Fix typo"

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

$ git stash apply

Updates saved to stash are queued, if you run git stash list you can see which stashes you have saved.

$ 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