So let's say you have branch master and production in your git repository, and you want to switch easily back and forth.
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.