In my job I usually find myself switching branches back and forth very often. This is sometime difficult to remember the last working tree you were on if you've already gone through a lot of changes.
So I setup two alias to use for checkouts.
co = "!git rev-parse --abbrev-ref HEAD > .last_branch ; git checkout"
coo = "!git co `cat .last_branch`"
When checking out a branch
git co -b new-branch it creates a new file in the root of your project called
.last_branch with just the current working tree before the checkout, then will checkout the branch allowing you to work as normal.
When you want to checkout the last branch just use
git coo and it'll
.last_branch file and checkout the original branch.
Very helpful when you find yourself working on many peoples branches very frequently.
Now you most likely are going to want to add
.last_branch to your .gitignore