Question: When you create a new repository called `temp` on GitHub, you are shown these instructions to follow locally:

```
echo "# temp" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:mattneub/temp.git
git push -u origin main

```

But I find in the `git branch` command, it's fine to say `-m` instead of `-M`. The former doesn't use "force"; the latter does.

So my question is: Why might GitHub be advising the use of force unnecessarily? Is it perhaps because Git itself changed recently to allow this?

Answer: 
As far as I can tell, for new repositories, the presence of `--force` (or `-m` vs `-M` since `-M` is equivalent to `-m -f`) when renaming branches makes no difference.

The ability to change the name for the default branch of a new repository was only introduced in Git 2.28 (July 2020), and prior to that it was hardcoded as `master`, which is still the default value for `init.defaultBranch` if it's empty.

Git manpage states that `-f` overwrites the target branch name if it's present, and make no difference otherwise, when used to rename branches.

---

So the whole argument boils down to preferences. From my experiences, renaming branches is already a rare operation, and it's often done only when one is confident about that, so `-M` is used more often. Then it's just whoever at GitHub decided to use `-M` on their website.
After some research and experimentation, I have to conclude that the GitHub folks are probably just playing very safe.

s iBug says, the `git init -b` command and the `init.defaultBranch` configuration are relatively recent, and are part of the push away from `master` as a default. `git branch -m`, on the other hand, has been around a long time.

There are times when `git branch -m` can fail; it isn't terribly likely, though. The main cases seem to be:

* You are altering the case of the branch name.
* You are giving the branch a name that already exists.

When you are first creating a repo locally, neither of those is likely to be the case. So GitHub's advice to use `-M` is probably overkill, but it is broader than `-m` so it's a way of taking no chances.