git branch <branchName>
git checkout <branchName>
Or, simply use: git checkout -b <branchName>
to create a branch and checkout immediately.
Checkout to the branch that you want to merge into and use merge
followed by the name of the branch to be merged:
git merge <branchName>
- If the branch is fully merged in its upstream branch, or in HEAD if no upstream was set, then :
git branch -d <branchname>
- Shortcut for -delete --force :
git branch -D <branchname>
- Delete a branch on your remote repository:
git push origin :<branchname>
git push origin <branchname>
git push --all origin
- If you are on the branch you want to rename:
git branch -m new-name
- If you are on a different branch:
git branch -m old-name new-name
- Delete the old-name remote branch and push the new-name local branch:
git push origin :old-name new-name