[Git] Rename a local branch with git branch -m

Created on November 30, 2026

git branch -m renames a local branch. With one argument, it renames the current branch.

git branch -m new-name

With two arguments, it renames the specified branch without checking it out.

git branch -m feature-old feature-new

When you run git branch afterward, the list shows feature-new.

  feature-new
* master

-m is short for --move. If you previously published the branch, its remote name and tracking settings may need separate updates.

Reference

Git