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 forcefully renames the branch from master (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) to main.
It allows the renaming of the branch even if the new branch name already exists.
git branch -M main
-M automatically renames the master branch to main.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With