Last Updated: February 25, 2016
·
10.63K
· amiel

Having to stash to switch branches?

Do you ever find yourself doing this?

$ git checkout some_branch
error: Your local changes to the following files would be overwritten by checkout:
        Gemfile
Please, commit your changes or stash them before you can switch branches.
Aborting
$ git stash
$ git checkout some_branch
$ git stash pop

Here’s a nice little shortcut:

$ git checkout --merge some_branch