Rename Branch Git

1. Rename your local branch.

If you are on the branch you want to rename:

git branch -m NEWNAME

If you are on a different branch:

git branch -m OLDNAME NEWNAME

2. Delete the old-name remote branch and push the NEWNAME local branch.

git push origin :OLDNAME NEWNAME

3. Reset the upstream branch for the NEWNAME local branch.

Switch to the branch and then:

git push origin -u NEWNAME

Leave a Reply

Your email address will not be published. Required fields are marked *