Using main as default branch

GitHub is going to change the default branch of repositories to main later this year. Rationale

I’m migrating my projects/repositories now. Here is what I do.

First change repo creation’s default branch on GitHub:

  1. Go to
  2. Click Change default branch name now — New repositories you create will use main as their default branch name.

Change git init’s default to main (requires Git 2.28):

git config --global init.defaultBranch main

Migrate existing projects: chancancode/branch-rename.

Hope this helps!