git branch -M master my-branch
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.
Source
and then
git fetch origin refs/heads/master:refs/heads/master
or
git branch master my-branch (or another ref)