I'm Parker.

Change your GitHub repos' default branch names

Over the weekend, I wrote a very simple tool for GitHub to change the default branch of your repos. The default branch name that Git and GitHub currently gives you is seen by many as insensitive. There’s no technical reason for keeping the name as-is so I wrote a tool to automate the process of switching for you!

github-change-default-branch is a command-line tool which walks through all repos from a user or organization on GitHub and prompts you to ask whether you’d like to change the default branch to a new name. You can change the target name with a flag:

$ github-change-default-branch -login=parkr -new-name=main
parkr/auto-reply - :loop: Handle GitHub webhooks and manage issues on your repositories. Currently runs @jekyllbot.
  change default branch from "master" to "main"? (y/n) >

If you choose to change the default branch, the program will do the following:

  1. Add a new ref with the given name at the same commit SHA as the current default branch
  2. Update the default branch setting for the repo to point to the new ref
  3. Delete the old default branch ref from the repo

To install into $GOPATH/bin:

$ go get github.com/parkr/github-utils/cmd/github-change-default-branch

Changing the name of the default branch for your repos has never been easier, so now there’s no excuse to keep the current insensitively-named default.