Tl;Dr – This is about changing your main branch in git to main. However, please read and think about what I am saying here.
When I started working with Version Control, the main branch was named trunk. I worked with code and we always branched away from trunk, which was our source of truth. I have no idea of the origin, though people seem to think this relates to trees. That makes sense.
Then why master? No idea. The inventor of Git is Linus Torvalds. He’s been accused of poor behavior, though I don’t know I think he is racist. Git was supposedly chosen as it’s an unpleasant person in British slang. That makes sense.
I followed him early on, and remember trying to get Linux 0.6 working on hardware. I was fascinated with his work, and I hope he chose “master” as the moniker for the main branch because of the verb definition rather than the noun. Who knows?
In any case, technology is littered with the use of “master” in our terminology. Replication, especially, but HA tech and in many places where we distribute something from one machine to another. I would like to think this is idea of one with more/better knowledge (the master, in the Kung Fu sense), distributing that to others.
However, there is the connotation of control.
The IETF agrees and has draft terminology change recommendations. In line with that, I saw a note from Scott Hanselman on changing your git default branch, this after I saw a few people this weekend noting they were submitting PRs to make the change.
I decided to do the same. I don’t know how to do this on GitHub without a local repo, so I’m following Scott’s process.
git branch –m master main
git push –u origin main
This moves all the code (all commits and history) to a branch called main. Then pushes this up and tracks it.
Once it’s there, I need to go to the repo settings and change the default branch to main and delete master. This will cause some issues on laptops, but those are up to date, or they have minor unpushed demo changes that I can abandon. I’ll then pull down the new structure of the repo.
Don’t do this haphazardly. Communicate with your team and ensure everyone is aware of the change. Then slowly work your way through the repos. It’s a chore but a small one. One I’ll be working my way through until I’m done.