DEV Community

Cover image for Main or Master: Where Do You Git-llegiances lie?
James 'Dante' Midzi
James 'Dante' Midzi

Posted on • Updated on

Main or Master: Where Do You Git-llegiances lie?

If you've been using github long enough, you'll recall a time where your primary branch was named master by default. Master was all we knew as the primary.

Then, I don't exactly recall when, a decision was made to now make the primary branch main. I say decision because although that's what most people switched to, not everyone was on board...

In a number of instances, these type of changes are thrust upon us and we end up accepting them. Even in cases when we're not 100% with them.

That got me curious about peoples preferences....

What do you prefer for your primary branch name; main or master? Also, why?


Thank you for reading, let's connect!

Thank you for visiting this little corner of mine. Let's connect on Twitter, Polywork and LinkedIn

Top comments (2)

Collapse
 
cicirello profile image
Vincent A. Cicirello

I have no preference. I go with the default. So my newer repositories have a default branch main and my older repositories have a default branch master.

I'm afraid of breaking stuff so won't rename the older ones. It's not as simple as just renaming the branch. CI/CD workflows would need to be carefully examined. But even if you get all of that correct, there may exist links to specific files in the default branch from blog posts, issue and PR comments, websites, etc. For Java projects with artifacts in Maven Central, the pom for a version may have a url to the default branch. And once published, artifacts cannot be changed in Maven Central. Renaming the default branch would break those urls for older versions.

Collapse
 
psypher1 profile image
James 'Dante' Midzi

Alright, that makes sense...

Thank you for explaining it in detail.