A trick I commonly use is:
cd -
Which goes back to the previous directly I was just on. They have the same thing for git as well: git checkout -
it's quite handy for switching back and forth between branches or directories!