git branch -M

From wikieduonline
Revision as of 10:57, 11 August 2022 by Cry (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

git branch -M
      With a -m or -M option, <oldbranch> will be renamed to <newbranch>. If <oldbranch> had a corresponding reflog, it is renamed to match <newbranch>, and a reflog entry is created to remember the branch
      renaming. If <newbranch> exists, -M must be used to force the rename to happen.

Rename branch:

git checkout -f yourbranch 
git branch -M yourNewBranch

See also[edit]

Advertising: