TIL: checkout the previous branch using git checkout –

If you want to check out a branch you had checked out right before switching to the current branch (usually during merges from main this will happen).

git checkout feature-branch
... do some work
git checkout main
... merge stuff
git checkout -
# ↑ this will take you back to feature-branch