Sometimes you may need to rename a branch that has also been pushed to the remote repository. This is actually quite simple…
1. Rename your local branch
From the branch you want to rename:
git checkout old-name git branch -m new-name
Renaming the branch from a different branch:
git branch -m old-name new-name
2. Update remote branch
git push origin :old-name new-name
3. Reset the upstream branch
Make sure you are on the new branch and then:
git push origin -u new-name
Be First to Comment