The fastest way to switch between two branches in Git
This is something you might already be aware of but if you’re using Git on your terminal, there’s a faster way to switch between two branches using the checkout command.
Here’s the command.
git checkout -
The command above will switch you to the last branch you were on. So, for instance, if you were on the
master branch and you switched to the
develop branch, running the command above will switch you back to the
And if you want to switch back to the
develop branch, you can run the same command again.
Trust me, this saves a lot of time and keystrokes.
And while we’re at it, you can also cd-ing between recent directories using a similar command.
Again, a very handy one!