How do you rename a git branch?

Posted . Visible to the public.

If you want to rename a branch while pointed to any branch, do:

git branch -m <oldname> <newname>

If you want to rename the current branch, you can do:

git branch -m <newname>

-m stands for "move" (or mv), which is how you rename files.

Daniel
Last edit
Daniel
Keywords
git
Posted by Daniel to Dev (2018-10-04 12:08)