today-i-learnt

Git get back to previous branch

Category git
Added on 2026-05-09

To quickly switch to previous in use branch:

$ git checkout -

In fact - is a synonym of @{-1} (previous branch) for more commands like git merge, git rebase, git switch. And you can pass @{-1} to all commands that accept branches and commits.