git branch -m <old_branchname> <new_branchname>
Rename a branch
This command renames a branch from <old_branchname>
to <new_branchname>
. It updates all references to the branch and creates a new branch with the
-m
is a shortcut for --move
Variations of this command include using the -M
flag instead of -m
to force renaming even if <new_branchname>
already exists. -M
is a shortcut for --move --force
.