Git Stash

With git stash, you can temporarily set aside your current updates to focus on other tasks.

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

1
$ git stash save "work in progress"

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

Now, you can attend to other tasks, such as fixing a bug or writing a test:

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

Afterward, you can return to your previous work using git stash apply:

1
$ git stash apply

Stashed updates are queued. To view the queue of changes, run:

1
$ git stash list

Here is an example of what you might see:

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

You can apply them individually using 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