DEV Community

Vasily Polovnyov
Vasily Polovnyov

Posted on

Git tip: use -

Git has a cool shortcut - — previous branch. It's great to use when navigating between branches:

# go back to the previous branch
git checkout -
Enter fullscreen mode Exit fullscreen mode

And during merge:

# merge the previous branch to the master
git checkout master && git merge -
Enter fullscreen mode Exit fullscreen mode

PROTIP: Checkout is the most popular command in Git. I suggest you aliasing it with git co to type it faster:

git config --global alias.co checkout
Enter fullscreen mode Exit fullscreen mode

More on this topic

Top comments (0)