Skip to content

How to Rename a Local Branch

Armen Avetisyan edited this page · 1 revision
Clone this wiki locally

How to Rename a Local Branch

  • If you're on the branch you want to rename:

      git branch -m new_name
  • If you're on a different branch:

      git branch -m old_name new_name

What is the difference between '-m' and '-M'

  • -m stands for "move" (or mv), which is how you rename files. It can throw an error if the branch with the same name exists.
  • But if you want to force save your branch, use '-M' instead.
Something went wrong with that request. Please try again.