ちょっと前にmaster
は人種差別を連想させるからデフォルトブランチはmaster
ではなくmain
にしよう!みたいな動きがあったと思いますが、デフォルトブランチはmaster
のまま使っておりまして毎回main
に手動で変更しておりました。
が、流石にめんどくさくなってきたので設定で変更しました。git init
した時も以下のようなhintが表示されていました。
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
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
デフォルトブランチをmainにする
git config --global init.defaultBranch main
現在のブランチ名をmainにする
git branch -M main