How to rename a local Git branch?

Renaming a Git repository’s local branch can be accomplished using the following command:

git branch -m <oldname> <newname>

For example, if you want to rename the branch called topic/wip to topic, run the command below:

git branch -m topic/wip topic

If you would like to rename the Git branch that you’re currently working on, use the command below:

git branch -m <newname>

Leave a Reply

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