Last Updated: February 25, 2016
·
551
· jmarizgit

Git: pausing commits

If you need checkout to a different branch but don't want to commit your changes just yet you can use git stash and save your commits for later. Here is how works ( you need to have pending commits on your working branch)

git stash

Now your commits are on hold, you can checkout to a different branch:

git checkout website

Stay on the branch website as much as you want. When you decide to go to the previous branch your commits will be waiting for you there:

git checkout --

List your pending commits:

git stash list

Apply your commits:

git stash apply

And you're done!