If you want to rename a local branch even if you have already pushed it to remote, follow the following steps.
Rename your local branch
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 remote branch and push the new local branch with new name
git push origin :old_name new_name
Reset the upstream branch for the new name local branch
git push origin -u new_name
Top comments (0)