Last Updated: February 25, 2016
·
580
· marcelocajueiro

git checkout - (previous branch)

If you do a lot of rebases or just switch many times between branches, this one is for you:

git checkout - will checkout the last branch you were.

# I'm in the branch foo_baz_bar
$ git checkout master
$ git pull
$ g checkout -
# and you are back in foo_baz_bar

Font: http://stackoverflow.com/questions/7206801/is-there-any-way-to-git-checkout-previous-branch