How to change git init default branch name?

By default, when you initialize a new git repository, it creates the master branch as the default branch name. You can also initialize a new git repository with a different default branch name than the master.

Using git init -b or –initial-branch=<branch-name> option (git version 2.28.0 onwards):

Using git configuration (git version 2.28.0 onwards):

Using git template (all git versions):

Leave a Reply