Skip to content
Home » How to rename Local Git Branch

How to rename Local Git Branch

To rename Local Git branch there are several options available. Below are different ways to rename local git branch depending on the scenario.

If you want to rename a branch and you are currently in a different branch then use:

git branch -m <branch_oldname> <branch_newname>

If you wish to rename the current branch you are working on the use:

git branch -m <branch_newname>

Finally, if you wish to push the local branch and reset the upstream branch then use:

git push origin -u <branch_newname>

Also Read:

How to Undo git add before commit ?