Back to all tips

Git Noob Tips

Git Default Branch

🗓️ Published: 5/13/2022

Until some 2 years ago, the default branch of every git repository was called "master". It was a synonym for "the default branch". Then there was an initiative to change this because it was offensive to some people. GitHub was the first one to react and changed the default branch name to "main". On git, the default branch name stayed "master", but an option was added to change it.

So, until recently, if you initialize a git repo locally, the default branch name would be master:

git init

This behavior was changed in the last version, and now it actively asks you to "set" a default branch name before it allows you to init. This is done as follows:

git config --global init.defaultBranch <name>

Some popular names are the following:

  • master: the original name
  • main: the one popularized by GitHub
  • trunk: the name used by the older version control tool, SVN
  • development: used in the repos with a certain workflow

Discuss this tip on