I understand Microsoft recently changed the initial branch name in the github repositories, but now when I run "git init" on my computer I get a yellow alert message explaining that I can change the initial branch name to "master ". . some other name. And that makes me uncomfortable and does not let me work at ease because I see a yellow message and by default I read because it catches my attention and that distracts me.
Now how to disable that message?
I don't have the slightest intention of changing the default setting of the branch name because to be honest that's kind of silly.
While “master” is the default name for a starting branch when you run git init which is the only reason it's widely used, “origin” is the default name for a remote when you run git clone. If you run git clone -o booyah instead, then you will have booyah/master as your default remote branch.
Phase 2 (Self-managed): We will change the default branch name from master to main for self-managed GitLab as part for our next major release 14.0, shipping on June 22, 2021. Any project created in GitLab post 14.0 will use the new default. This does not affect existing projects.
Newer versions of Git indeed produce a warning when initting a new repository:
$ git init
warning: templates not found in /home/ja/share/git-core/templates
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /tmp/new/.git/
Now how to disable that message?
It says right there:
To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
So if you want to keep using master:
git config --global init.defaultBranch master
BTW,
I understand Microsoft recently changed the initial branch name in the github repositories
Microsoft is big and powerful but it doesn't own Git.
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