8

新しい Git リポジトリを作成すると、次のメッセージが表示されるようになりました。

Initialized empty Git repository in /private/var/folders/g5/8twmk1xj481_6btvppyw5j4h0000gp/T/.tmpNYVg6H/.git/
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>

グローバル git 設定を変更せずにこのメッセージを抑制する方法はありますか?

4

2 に答える 2

8

できるらしい

git init --quiet   # or git init -q

他のどの情報が抑制されるかは正確にはわかりませんが、この通知は抑制されます。

ただし、最初のブランチ名が適切に定義されていないことを意味します (たとえばmain、後で変更される可能性があります)。したがって、おそらくこれを行うのが最善です。

git init --initial-branch=master    # or git init -b master
于 2021-03-04T21:42:05.290 に答える