Return to previous branch
Switches back to the last branch.
- Use
git checkout -
to switch back to the previous branch.
git checkout - # Examples git checkout patch-1 git checkout master git checkout - # Switches to `patch-1`
Switches back to the last branch.
git checkout -
to switch back to the previous branch.git checkout - # Examples git checkout patch-1 git checkout master git checkout - # Switches to `patch-1`
Did you make a mistake but haven't pushed your changes yet? Learn how to rewind back to a specific commit in Git.
Switches to an existing branch.
Did you accidentally commit to master
instead of a feature branch? Here's how you can move those commits to a new branch.
Creates and switches to a new branch, optionally setting up a remote tracking branch.