nwi3mw
Last Updated: February 25, 2016
·
355
· edgarjs

Go to the previous git branch

So let's say you have branch master and production in your git repository, and you want to switch easily back and forth.

Just do:

git checkout -

That will take you to the last branch you was at. Of course this applies to commits also.

FYI, this works the same as cd - for changing to the last directory.