Switch to the previous branch in git
If you use git and change between branches often, you'll certainly find this handy
git checkout -
The above command will checkout the previous branch you were on.
Lets see an example. If you were to checkout a feature branch like so:
git checkout feature/my_super_new_thingy_what_I_done
Then change to another branch
git checkout master
To get back to the feature branch, you simply have to do
git checkout -
I like it because I dont have to remember the previous branch name (or go on a scroll hunt looking for it in my buffers)
Written by Ben
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#