0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

git init するときのデフォルトブランチ名をmainに設定する方法

Posted at

やり方

git config --global init.defaultBranch main

これで git init したときのデフォルトブランチ名が main に設定されます

詳細

ほぼ1年前ですがgitのバージョン2.28からinit時のデフォルトブランチ名に関する設定が可能になっています
詳細は以下記事を参照ください

ちなみに

これまた随分前の話ですがGitHubは2020年10月にリポジトリのデフォルトブランチをmainに変更することを発表しています。

久々に git init したら下記のようなヒントメッセージが表示され、デフォルトブランチの変更に誘導されました
こういう親切なCLIはありがたいですね。

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?