Master No More


πŸŽ„This post has fully grown

It's been a long time coming. We use some very harsh language within tech so much sometimes that we become numb to it. It's time to do my very small part in this movement and purge this language from my active repos starting with this blog right here.

article cover for Large Refactor At The Command Line

Large Refactor At The Command Line

As projects grow patterns that worked early on break and we need to change things to make the project easier to work wit

read more

this post follows my method of refactoring code bases from the command line, read more about that in this article.


First off browsing through the content of my blog I found many references to master. I cannot completely whole-sale find and replace each one of them, because some of them are links that I do not own. Any set of instructions got upgraded from master to main

-  git checkout master
+  git checkout main

There were countless cases of examples like this to comb through, but it feels good to have them purged of old language.

rename routes

Following yesterdays post, I am going to rename my markdown files



- /gdfm              /blog/today-i-learned-git-diff-feature-master/
- /blog/gdfm         /blog/today-i-learned-git-diff-feature-master/
+ /gdfm              /blog/today-i-learned-git-diff-feature-main/
+ /blog/gdfm         /blog/today-i-learned-git-diff-feature-main/

redirect posts

+ # master -> main
+ /blog/today-i-learned-git-diff-feature-master/   /blog/git-diff-feature-main/

redirect external links to repo

- /redirects
+ /redirects

More info on refactoring your blog routes with netlify here.

gracefully redirect cover image

"Edit This post" Links

I literally just added "edit this post" links to my rss feed and my blog feed. This was a simple find and replace inside of my blog template and gatsby-config.js

Don't Forget about CI

If you have build/deploy processes that specifically run on master or not on master dont forget to change those to main. I did everything in a single commit and as soon as I pushed to main it started deploying gloriously.

name: 🌱 Deploy site

-      - master
+      - main

Now the fun part

removing master completely

I mostly just followed this post by Scott Hanselman.

git branch -m master main
git push -u origin main

Then from GitHub go to settings>default branch> select main and accept the risk involved.

After your default is set to main, you have no use for master in your life anymore, time to purge it completely once and for all. Go to /branches and trash it.

delete master

Stop the Bleeding

I like how Scott included this nice alias for starting from main from the beginning.

git config --global '!git init && git symbolic-ref HEAD refs/heads/main'

See the Full Diff

If you happen to want to see the full diff of my change you can see it here.

πŸ‘€ see an issue, edit this post on GitHub

If you found value in this post
and want to send a tip.

Buy Me A Coffee

tweet about this post and it will show up here.

←An IndieWeb Webring πŸ•ΈπŸ’β†’