Git - Switch to previous branch
til command-line git
Use the git switch -
(Or git checkout -
) to switch to the previous branch you were working with.
git:(master) $ git switch my-new-feature
Switched to branch 'my-new-feature'
git:(my-new-feature) $ git switch -
Switched to branch 'master'
git:(master) $
This is pretty similar to the cd -
command, which is used to switch to the previous directory.
The -
can also be combined with commands like git rebase
and git merge
.
Use the git rebase -
to rebase the previous branch you were working with, on to the current branch
$ git rebase -
Use the git merge -
to merge to the previous branch you were working with, on to the current branch
$ git merge -
See Also
- Kill process listening on a particular port
- Find which process is listening on a particular port
- Better zsh history