Rename branch

To rename branch, you can use -m option of git branch.

Rename <oldbranch> to <newbranch>

$ git branch -m <oldbranch> <newbranch>

Rename current branch to <newbranch>

$ git branch -m <newbranch>

If <newbranch> exists, -M instead of -m must be used to force the rename to happen.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.