Reputation: 4126
Is there a command to permit checkout the last branch? Like:
git checkout --recent
or
git checkout --previous
The idea is when you switch branch too often you it's easy to forget the branch you were working before the current one. Also if there's a way to set a alias for this that would be valide.
Upvotes: 5
Views: 394
Reputation: 7521
What you're looking for is -
git checkout -
For example, say you're on branch foo
, and there exists a branch bar
.
* foo
bar
Check out bar
> git checkout bar
foo
* bar
Going back to foo
> git checkout -
* foo
bar
The -
"shortcut" also works for the cd
and ls
commands from within a bash terminal.
Upvotes: 8