はじめに デフォルトブランチ名はmasterだった
2020年後半にGitを導入してから設定変更をせずにきてました。先日、Git init
をしたところ長めの英文が表示されました。
$ git init 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>
英文の意味としては 、イニシャルブランチに「master」って名前は今後デフォ名称は変わる可能性あるよ。警告出さないように設定してくれよなって感じ。
今はデフォの設定は違うみたいです。2021年6月以降からデフォのブランチ名は「main」になってます。
デフォルトブランチ名を変える
Gitが表示してくれたヒントに沿ってデフォルトブランテ名を変えればOK。特に問題がないままきてしまったのでこの際に切り替えます。
$ git config --global init.defaultBranch <name>
なんでデフォルトブランチ名が変わったのか
「master」という言葉に含まれる「隷属」や「統治」の意味合いが不適切ということらしいです。このへんのニュアンスは難しいですね。