Asked by Sohail · · 1 answer

Rename the current branch:

git branch -m <newname>

Rename a branch while pointed to any branch:

git branch -m <oldname> <newname>

The easy way to remember this branch -m by creating git alias. Use following command to create git alias:

git config --global alias.rename 'branch -m'

Now you can use:

git rename <newname>
# or
git rename <oldname> <newname>