Reputation: 734
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.
Upvotes: 21
Views: 16833
Reputation: 409
Specify the default branch in the init command without changing the configuration
git -c init.defaultBranch=master init
Upvotes: 6
Reputation: 12383
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.
Upvotes: 34