Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Stash

  • You are in the middle of a change (some files have changed in your working directory) when you suddenly think about some refactoring to be done.

  • How to save the local changes easily?

  • Change some files locally

$ git stash        # saves all the changes and leaves the directory clean
Saved working directory and index state WIP on master: 6217360 last-commit
HEAD is now at 6217360 last-commit
$ git stash list
stash@{0}: WIP on master: 6217360 last-commit
  • Make some other changes, add and commit them.
$ git stash pop     # will merge the stashed changes