Wednesday 23 August 2017

Rename local git branch

Problem:

How do I rename a local git branch using git command line?

Solution:

If you'd like to rename the currently checked-out branch to "new_branch_name":

git branch -m new_branch_name

If you'd like to rename any branch ("old_branch_name") to "new_branch_name":

git branch -m old_branch_name new_branch_name

References: