How can I create a Git repository with the default branch name other than “master”?

后端 未结 4 1327
感情败类
感情败类 2020-12-22 16:35

In the Pro Git book, it says

“origin” is not special

Just like the branch name “master” does not have any special meaning in Git, neither does “or

4条回答
  •  忘掉有多难
    2020-12-22 17:27

    Since Git 2.28 (released July 27, 2020) a new configuration option, init.defaultBranch is being introduced to replace the hard-coded term master.

    Default remains to master!

    The user can override the default value of the configuration variable with:

    $ git config --global init.defaultBranch main
    

    Read the git doc chapter for further details Introducing init.defaultBranch

提交回复
热议问题