init.defaultBranch
The setting that chooses the name of the first branch in a newly created repository, such as main.
In more detail
Without it, older Git versions name the first branch master and print a hint suggesting you choose. Setting git config --global init.defaultBranch main makes every new repository start on main.
Example
git config --global init.defaultBranch mainRelated terms
- main branch — The branch a repository treats as its primary line of work, usually named main (older repositories often use master).
- git init — The command that turns the current directory into a Git repository by creating the hidden .git directory.
Taught in
- Installing Git, And Telling It Who You Are — Advanced Git Internals & Distributed Workflows