What does the -M mean in git branch -M main?
GitHub says to enter git branch -M main
as a step for creating a new repository on the command line. What does the -M
mean?
-M is a flag (shortcut) for --move --force
per the docs page on git branch
. It renames the branch main
(since the default branch name for repositories created using the command line is master
, while those created in GitHub [starting in Oct. 2020] have a default name of main
) and forces it (allows renaming of the branch even if the new branch name already exists).