jump to main content
Dark Mode

Git: Rename branch

Rename Git local branch

This can be done from any branch within the repository.

git branch -m <old-branch-name> <new-branch-name>

However, you can ommit the old-branch-name if it is currently checked out locally.

Rename Git remote branch

First rename the branch locally. Then we need to remove the old branch

git push origin --delete <old-branch-name>

and push the new branch name

git push origin -u <new-branch-name>