Git Tip - How To Git Checkout to Previous Branch Without Typing is Name

Each time we need to checkout to the previous branch we have been, we type git checkout previous-branch-name or when using ZSH Shell we can just type gco previous-branch-name.

How to Git Checkout to Previous Branch in a Lazy and Fast Way

Instead of the traditional way, described above, we can be lazy and fast at same time ;)

Just type git checkout - or if using ZSH Shell gco -.

Wtf how I have not remembered to try this before, this is working exactly like when working with directories, when using cd -.

Sometimes I just hate my self for not spotting so obvious behaviours… argh!!!

Don’t be Lazy

In return to this post I only ask that you spent 1 minute of your time to Share It on your Social Networks, leave a Disqus Comment or start to Follow Me in any of my Social Networks.

Seeing this actions taking place will keep me MOTIVATED to continue writing more Blog Posts 😃


What I write and express here is only in my behalf and do not represent the company I work for, or any previous one, neither my family, friend, colleague or any body else unless it is explicitly identified by me.

English is not my natural language, so feel free to point out any incorrectness for en-GB… I will welcome all your help :)

comments powered by Disqus