I don\'t want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories.
How can I rename a local branch wh
The answers so far have been correct, but here is some additional information:
One can safely rename a branch with '-m' (move), but one has to be careful with '-M', because it forces the rename, even if there is an existing branch with the same name already. Here is the excerpt from the 'git-branch' man page:
With a -m or -M option,
will be renamed to
. If
had a corresponding reflog, it is renamed to match
, and a reflog entry is created to remember the branch renaming. If
exists, -M must be used to force the rename to happen.