Last Updated: February 25, 2016
·
1.424K
· akalyaev

Git - checkout previous branch easily

You probably know you can go back to the previous directory by typing the following command in your terminal: cd -.

Example:

> cd projects
> pwd
/home/antonk/projects
> cd -
~
> pwd
/home/antonk

But, do you know git also can do actually the same when you are working with multiple branches ?

(develop) > git checkout staging
Switched to branch 'staging'
(staging) > git checkout -      
Switched to branch 'develop'