TIL - How To Git Checkout to Previous Branch Without Typing it's Name

The Usual Way

Each time we need to checkout to the previous branch, 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 -.

How come that I haven’t remembered to try this before, this is exactly like when working with directories, aka just like when we use cd -.

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


Disclaimer: What I expressed here is only in my behalf and doesn't represent the company I work for, or any previous one, neither my family, friends, colleagues or anyone else unless I explicitly say so.

Keeping me Motivated

Was this post useful to you? Did you enjoyed reading it? Did you learned something new?

If so, in return I only ask you to show your appreciation by Sharing It:

Don't miss my next article. To stay on the loop, just Follow Me at:

If you are feelling really generous you can always offer me a coffee or a beer.

Your actions will keep me MOTIVATED to continue writing more Blog Posts 😃

Comments

Disqus is disabled on my Blog because I don't agree with their policies.