Just do:
git checkout -
Note the dash. This checks out the latest branch you were on before the current one.
As you can see, the syntax is analogous to cd -
Domanda
Is there a simple way to switch back to the branch you were most recently on prior to the current one? The same concept as "cd -" from the command line.
When working on multiple branches, this can be useful.
Soluzione
Just do:
git checkout -
Note the dash. This checks out the latest branch you were on before the current one.
As you can see, the syntax is analogous to cd -
Altri suggerimenti
I never would have found this without the answer from @KlasMellbourn, but this is actually mentioned in the git-checkout(1) man page (in the portion describing <branch>
):
As a special case, the "@{-N}" syntax for the N-th last branch checks out the
branch (instead of detaching). You may also specify - which is synonymous with
"@{-1}".