Renaming a Git Branch
# Renaming Both a Local Branch and Its Remote Counterpart
Before renaming, make sure the local branch is up to date and that the rename won't break anything for your teammates.
- Rename the local branch
git branch -m oldBranchName newBranchName
1
- Delete the remote branch
git push origin :oldBranchName
# or: git push origin --delete oldBranchName
1
2
2
- Push the renamed local branch to the remote
git push --set-upstream origin newBranchName
1
Edit (opens new window)
Last Updated: 2026/03/21, 12:14:36