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. https://github.com/parkr/auto-reply change default branch from "master" to "main"? (y/n) >
If you choose to change the default branch, the program will do the following:
To install into
$ 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.