CoderJony

How to rename a local GIT Branch?

Git

If you want to rename the branch you are currently working on, hit below command:

git branch -m <newBranchName>
Bash

If the branch you want to rename is different from your current branch, then hit below command

git branch -m <oldBranchName> <newBranchName>
Bash

To check your current branch, hit below command. You can see the current branch highlighted followed by an asterisk.

git branch
Bash

The same question has also been asked here as well @ StackOverflow.

Buy Me A Coffee
profile-sample1
profile-image

Ankush JainSoftware Engineer

Recent Posts