loading...
Cover image for Replacing master in git

Replacing master in git

damcosset profile image Damien Cosset Updated on ・4 min read

Master/slave denomination

The master/slave denomination is a common one in technology. Master/slave is an oppressive metaphor referring to the practice of slavery. These metaphors are inappropriate when describing concepts in technology. They are also inaccurate. Using these metaphors takes away the history of slavery and put it into a context where it does not belong.

UPDATE: People seem to push back on this, for whatever reason... Git's master is historically tied to master/slave. It got the name from BitKeeper. Source here

UPDATE 2: Github is looking to replace the master word

UPDATE 3: This blew up. I'll have to reflect on many things about this subject. I still think that the word should go away from git. Period. However, I was not the right person to brought that kind of topic on the table. I have done harm in the process and I apologize for that. I'm leaving this article up for accountability. Learning to shut up listening and prioritize Black voices is something I will work on.

Words matter. The words we use to define concepts have a lot of importance, even in our tech environment. Git is one of those environments where the word master is still used. But, it's not that complicated to take it away. We have to do two things:

  • Replacing the word on existing branches, both locally and remotely
  • Modify your git configuration to not use the word master when running git init

Let's start with the first point.

Replacing master from your existing projects

First off, we have to change our master branch locally.

Changing master to principal

I have here a project with a master branch. I'm running git branch -m master principal to rename my master branch into the principal one. This command keeps the history of the branch, so you won't lose anything!

Note: I chose to rename the branch as principal. You can choose another name if you wish. It has to make sense for you and your team.

Running git push -u origin principal updates the remote repository by adding the principal branch. The -u flag also sets the upstream.

Change the default branch on Github

Now, I also need to change the default branch on Github. In your repository page, click on the Settings tab, then branches on the left menu. You can update the default branch here:

Updating the default branch on Github

And you are done! If you run git log inside the principal branch, you will see that the history is intact!

Git log on principal branch

We started on origin/master and it properly show that we are on principal now!

Updating local clones

What if someone has a local clone of this repository, how would they correctly update their clone?

This tweet explains you how:


$ git checkout master
$ git branch -m master principal
$ git fetch
$ git branch --unset-upstream
$ git branch -u origin/principal
$ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/principal

Note that the tweet uses the word main to replace master. I'm using principal. Just replace it in the commands with the name you chose.

What these commands do:

  • Go to the master branch
  • Rename the branch to principal
  • Get the latest changes from the server
  • --unset-upstream removes the link to origin/master
  • -u origin/principal creates the link to principal
  • Updates the default branch

Git init

When you run git init, the default branch is master. There are two ways to change that:

Using an alias

You can set up an alias that would run git init while having a other default branch name:

git config --global alias.new '!git init && git symbolic-ref HEAD refs/heads/principal'

Running the above command would allow you to use git new and it would have the principal branch as its default.

You can modify this command of course. Notice the alias.new, this can be change to alias.initialization for example, or whatever command you would like to make. Of course, you can also modify the principal name to fit your needs.

Modifying your git config

We can configure our git to change the default branch.

  • Find the configuration file of your git. It should be either in ~/.config/git/config or ~/.gitconfig.

  • Inside this file, add the following lines:

[init]
    templateDir = ~/.config/git/template/

Now, inside ~/.config/git/template ( you may have to first run mkdir ~/.config/git/template to create it), create a HEAD file and add this line, plus a line break.

ref: refs/heads/principal

When you run git init, the whole contents of the templateDir is copied into .git.

You can now run git init and you will have the branch principal as its default!

Of course, you can change principal to another name if you wish.

Alternative names

I've chosen to use the word principal to replace master here. Here are other words you can use:

  • main
  • primary
  • leader
  • active
  • parent

Just don't use master...

Have fun ❤️
Do no harm.

Sources

Posted on by:

damcosset profile

Damien Cosset

@damcosset

French web developer mostly interested in Javascript and JAVA

Discussion

pic
Editor guide
 

"Master/slave is an oppressive metaphor".

There are so many problems with that statement that what I initially wrote as a quick response has turned into a longer post. Read it at 8 problems with replacing "master" in Git.

This comment is only kept for historical purposes.


First off...

1. There's no "slave" in Git.

Maybe RAID disk arrays would have this problem, but not git. So there's no "master/slave" metaphor in Git to speak of.

2. Words change meanings over time

"Master" is a term used the recording industry, or to talk about skill ("Master of Science", "Kung Fu Master" etc.). I'm not a native English speaker so "master" was strange to me too, but in American English "master" has been far more commonly used in the past 50 years to talk about vinyl records and CDs and degrees and expertise, than slavery. As someone else said,

These terms have existed for decades and now suddenly we feel they're racially loaded? I think this is a knee jerk reaction to a problem that doesn't exist.

3. Nothing is oppressive by itself

People choose meanings. Epictetus famously said this of insults (and "master" is far from an insult, but to illustrate the point):

“Remember, it is not enough to be insulted to be harmed, you must believe that you are being harmed. If someone succeeds in provoking you, realize that your mind is complicit in the provocation. It is not he who reviles you who insults you, but your opinion that these things are insulting."

4. Who does the word "master" really offend?

Has anyone ever complained of being oppressed when they saw a "master" branch in a Git repo? From what I've seen so far, black developers haven't felt offended by this word.

Blacks don't give a damn

5. What are the downsides of this rename?

When making a decision of this scale, that invalidates 15 years of scripts and CI processes and Git tutorials using the word "master", it would help to see its ROI. If nobody is actually choosing to be offended by this word, then all we're doing is wasting time changing a perfectly working process just to virtue-signal that we're "woke", while annoying far more people in the process and wasting their time when "master" won't work and "principal" will break things. Do consider that the vast majority of developers have nothing to do with oppression, and have never intended to oppress anyone.

6. Is this purely a PR move?

But hey, by being outspoken against "master", brands benefit from stoking the fires of racial conflict to elevate themselves in the eyes of consumers. Sony, an organization using cobalt mined by literal black slaves, including children, is in favor of BLM. GitHub renaming a branch is a cheap PR stunt when they could do far more meaningful things, like not working with the ICE:

Github contact with the ICE

...or not banning Iranian developers, suggesting they use GitHub to develop nuclear weapons.

7. What shall we rename next?

Slaves were hanged from branches at some point, should the word "branch" be changed? How about the Lighthouse web speed auditing tool? Light is usually white... How about the Invictus poem? Let's ban it!

I am the master of my fate:
I am the captain of my soul

8. Is this humiliating to black developers?

Last, and worst, by removing the word "master" blindly, we're uncritically reproducing a narrative that diminishes black agency in favor of a white-centric explanation. We're making the assumption that a black developer can't take the word "master" as simply a label and nothing more. Don't you think black developers may find that assumption humiliating?

 

I totally agree with your points, I think these kind of changes are only making things worse than they were before, I never heard anyone who ever complained about this term.

I am a developer and I am black(not speaking for anyone else of color) yet I have never felt offended by a word I see in a software that I use or don't use, I think there are far much better things we can do as a community if we agree to live with our different cultures.

 

Well I'm not changing! Master stays! Period!

 

It's like one of those parodies where white people make a remark about something "black", realize that they said this in the presence of a black person in the background, and feel compelled to assure them by clarifying that they weren't actually talking about black people, when that thought never crossed the person's mind. It's ironically the very kind of racist behavior that OP and GitHub claim to oppose.

 
Sloan, the sloth mascot Comment marked as low quality/non-constructive by the community View code of conduct

I really expected this to be a joke. But horrifiedly it seems to be real to some people. This mass hysteria is very strange to me. People really are that stupid.
Lets destroy all history and never learn anything from the past. Yeah
Anyone ever checked the skin color of someone doing a pull request before looking at the code?
It's cray.

 

"Words matter. The words we use to define concepts have a lot of importance"

Yep, they do. Context also matters. Pretending you don't know a word doesn't make whatever connotations may apply to said word (out of context) magically disappear. Should we also stop using the word "integrated" in IDE, since it's also a reminder if you take it entirely out of context? How about "dark" color schemes and "race" conditions? On other "trigger" words, as mentioned in other comments, are you also going to insist on renaming FAT (file allocation table)? How about "smart TVs", since the name must surely be offensive to those who got a low SAT score, or even "SAT" for paraplegics who find its association with "stood" offensive? How about the handiman's footstool? Stool means poop in the same lack-of-context you're applying to Git's branches. Poop is gross so we shouldn't call a tool a piece of poop. For that matter, we're all using tools here, and "tool" is sometimes used as an insult, so we obviously need a new word for the things we're using every day to do our jobs.

The rabbit-hole of stereotypical SJW bullshit always goes deeper. Language has context, and that matters.

 

Nicely done! I've been using "unstable" for a while now, just due to my sheer love of Redis (this is their main branch name) - - - AND the fact that I have a healthy skepticism about whether any given commit I make will actually work 😉

Pulling in fewer cultural connotations is bonus! ✌️

 

Haha, I've never heard of the unstable branch before, but that's a nice touch. If my imposter syndrome is kicking in that day, I'm not sure I would have enough courage to push to an unstable branch 😆

 

Nice to know I'm not the only one affected by imposter syndrome. haha!

No no no. I belong precisely because I ship errors 😉 mistakes are fun and universal 🌌

 

Is it implying that the HEAD of the default branch is the unstable release and Tagged versions are stable releases?

Yeah, and they also hang onto release branches in addition to the tags

 
 

This is confusing since to me "master" = "release" branch and the unstable branch is "develop". Of course I have about 20 repos and like 18 of them have no develop branch. So changing "master" to "unstable" and having no releases is more accurate for me! Using unstable would be a warning to everyone.

 

I think I'm going to name mine 'disturbed' and let THAT be a warning to everyone. 🤣

Haha 🏆 💯 🌟

 

Yeah I think Redis specifically likes to just discourage people treating their default branch as the source of truth. So I think that can be helpful in some legitimate measure. I've worked on teams where it's like, "master is sacred". Also valid, just depends on the local attitude

 

On a deep thinking, there is indeed another way.

Stop using English for everything. (and stop being anglio-centric.) English is mostly widely-used by people who, in the past, tried colonialism and tried to find "helpers" around the world, anyway.

 

What alternative do you propose? What language would be widely understood and has never been used by an oppressive culture?

 

Please, let's not get ridiculous. There's no feasible alternative to English. I've been writing about this since 2008. English unites us, regardless of native tongue, ethnicity, skin color etc.

It's a terrible argument to say

"English was used 200 years ago for something bad, therefore we should stop using English"

By the same logic, we should stop using computers because computers were used to perpetrate billion-dollar hacks.

Spot on. You could even expand further on it.
Don't forget that IBM provided the logistic systems that were used to run Hitler's concentration camps.
Swiped a Master-card recently when shopping? How about Visa, thinking about borders here...or American Express, which could be argued makes references to the US railroad system, built in part by slave labor. Where should we stop?

 

I think French and Esperanto have tried at some point, but failed.

The only alternative I think is possible is, Simple English. That is, English with limited words. However, there would still be things like black, white, and main.

It is hard to be politically correct and please everyone.

You suggest French as an alternative to English, as if they’ve been somehow less colonial and oppressive throughout the ages?

Simple English isn’t a language. We’re programmers; our very work involves a lot of specialized terminology that wouldn’t come close to meeting the requirements of a “simple” English.

(And what’s wrong with “main”?)

 

OK, I've never thought about this before. You just blew my mind...

One of the things we never discuss is the language we use...

Wow. As a French speaker, I can't believe I never questioned once that... Thank you ❤️

 

English is the most spoken language in the world, and the 3rd in the number of native speakers. Computers, and most modern technology is derived from inventions created by English speakers, mostly native ones. That is not going to change any time soon.

 

I assumed he was just being funny with such a ridiculous suggestion.

I don't think he got the memo, lol.

 

World class troll. Thanks for this 🤣

 

That wasn't my intention, but it did indeed go further than I thought.

 

I assume you're joking in which case: Classic! I love it.

Let's take this to its logical extreme where people who never owned a slave in their life are not able to use the only language they know how to speak: English, because some of their distant ancestors owned slaves. What about black people whose distant ancestors were actually slaves but only know how to speak English? Should they also stop using English?

The concept reaches ridiculously humorous outcomes in mere milliseconds so I think it's worth further exploration.

Maybe we should use French, Dutch, Portugese or Spanish... dang! They were all colonizers also...

A crazy thing I heard of recently is that in the 1600s the English enslaved hundreds of thousands of Irish (white) people also - sending them to the Carribean. They were actually worth only about 1/5th the value of an African slave for some reason - maybe they blistered up with sunburn and were in constant pain in the hot, sunny climate that they their skin had not evolved to deal with.

It was enlightening to realize that some white people were also slaves to other white people.

Ah, it's a strange, mixed up world we live in...

 

Ok, if you want it, then do it. No harm.
But you have to see that all the projects are being written and given support in english because from the languages that are spoken by the majority, is the easiest of them (Spanish and Chinese are not as easy as english).
Yes, we could use Esperanto, but not everyone knows it.
Think as a developer: how many of your libraries/frameworks you'll have to replace and refactor if the Original Developer decides to write the whole resource in their native language... And also, how many will stop being available because of this?
But as I said in the beginnning: you may do it to your own code, but you'll have serious issues when trying to look for some support.
Or, as Jason Tibbetts stated: what solution do you propose? This is causing more troubles, rather than giving a solution.

 

Not using English for everything is going to be impossible. English is the language of business and like it or not connects the world. That doesn't mean that other languages are not important, valid, for viable; but it will be next to impossible to shift the entire world to a different language.

 

If we visualize Git as a flow of branches from a single point in history, then names like default and main are more accurate. I would even use origin, but it's usually reserved for Git remotes when forking repositories. For myself, a branch called master would tell that branch has total control over other branches which is not the case with Git.

The push back in this issue is very typical human behaviour visible in many discussions in our society. When someone declares that eating red meat is bad for you, there usually is at least one stating how they will grow their meat consumption just to arouse reaction and potentially ease their insecurity.

Let's strive for a more inclusive future in tech and make software that is painless to evolve as time goes by.

 

When I was first learning git I found master to be wholly unhelpful in helping me grasp the concepts.

I also feel like when I was getting familiar with continuous integration I again would have gripped things better if explicit and purposeful main and secondary branch naming were a thing instead of the master terminology.

 

Why not just call it default? After all is the default branch.

 

In our organization, develop is the default branch. I like the suggestion above of using production or release.

 

As others pointed out "master" is not always "production" or "release". In our work flow it is not. That feels like the main practical issue. We can't all agree on a branching strategy and everyone deploys differently. Code has to move differently. Any name that has to do with "production" is out for us -- it doesn't work.

As others pointed out "master" is not always "production" or "release". In our work flow it is not.

That's an argument in favor of "production" being the name of the default branch, because then it forces you to be mindful about setting up your workflow and using the intended process from the get-go (even if that setup ultimately becomes automated). Something rather generic and non-descriptive like "master" allows for people to fall into bad habits during the beginning of a new project, even when the process dictates otherwise.

Any name that has to do with "production" is out for us -- it doesn't work.

What's your workflow look like?

No it isn't. It assume you want to release from the default branch. We don't and I am sure there are many others that do not either. There is no single workflow that is correct for everyone. I am very much against anything in a tool that forces a workflow. As soon as you do that you will find people needing to work against that workflow. It creates unnecessary friction. Master makes far more sense as the default branch name. It is the "master" copy from which all other copies are made. Think recording master for film -- less of a thing since we are basically all digital now but that isn't the point.

As far as what we do... We have branches for each environment; Dev, Beta, Demo, and Release (Production). Each environment has its own web, file, and database servers. A typical change workflow goes like this (feel free to substitute merge and pull request as you like -- they are effectively the same in terms of the end result).

A feature branch is made from master -> development work done -> feature is merged to beta for testing -> merged to demo for external UAT

From here once QA and UAT are done we have a group that reviews items pending release. We sometimes have conflicting timing needs or things that are interdependent. We have a lot of different things going on so not everything that finishes UAT is released just because it has passed. The code makes its way into into master when it is approved for release. Once approved the feature is merged into master, call it a release candidate if you want.

From there a merge is done from master to release. Builds are connected with each environment branch to deploy as needed. Our releases happen once a week at the same time. We need to maintain a link to what is in production in case we need to hot fix. It is rare but it does happen.

Could we do it differently? Probably. Are there better ways? Probably. Is this way wrong? I don't believe so. We have had a very good success rate with it. We aren't containerized. We have heavy environments. It is just the way it is. So we are managing what we have that gives us speed of process with some security / safety.

I would LOVE to be in a fully CD/CI pipeline. We just aren't there yet. I don't think I would change much about the process other than automating a lot of the steps though. I would still want unique branches by environment. It just makes things clean, clear, and easy. What is in production? Look at the release branch. It'll tell you.

I don't care that much if the name is changed (although to me there are far more issues than folks are willing to openly discuss with renaming the default branch). Trunk is better as it has a similar meaning. But git hates svn... I am very much against anything that would imply a workflow.

No it isn't. It assume you want to release from the default branch.

Okay, it seems my attempt to describe what I'm talking about more succinctly failed.

Let me retry with the full text that I posted elsewhere:

In my opinion, naming the default branch "prod" (or some variation) is actually a fantastic idea almost regardless of workflow. Here's why:

In every workflow, there's a branch, somewhere, that pushes to production. Whether that's the default or not and what exactly it's named isn't particularly relevant in the context of git (branches can always be changed). It's still the one that gets pushed to the production server or pulled by the pipeline to build the production result in some fashion. This makes it explicitly clear that this branch is the production one.

Naming the default branch "prod" sets up that expectation and discourages directly changing the code on that branch from the get-go (something I know I'm guilty of). In other words, it forces us to be mindful of what we're doing, even early in the project, where habits are most likely to be formed and ingrained, but workflows and processes are most likely to be super loose. We start with the habits we want in the long run, instead of allowing bad habits and then having to unlearn them later.

In workflows where the default branch isn't supposed to be "prod," it forces that split immediately (again, avoiding the fast-and-loose tendency that can happen early in a project), by forcing a new branch to be created to become the new default branch.

The beauty, too, is that most of this can be automated with aliases if you want the automation. Then you get the git scaffolding your project needs from the beginning, and you've still gone through the process of making thoughtful decisions about it (or, you made the deliberate effort to not be thoughtful and mindful about how you set up your git repository).


Master makes far more sense as the default branch name. It is the "master" copy from which all other copies are made.

You rail against assuming workflow and yet you're doing exactly that here. I've worked with several workflows where master very much isn't the "master copy from which all other copies are made." In fact, I've used workflows where "master" was not branched from at all after the initial workflow setup. (My static sites use "master" for their generated output. That branch doesn't even have history, because the pipeline nukes it with each update.)

But here's the thing: no matter what the default branch is named, git doesn't assume workflow. The default branch only exists because it needs a branch to work with. Git itself doesn't even follow your "master branch is master copy" paradigm except in the loosest of senses (because it needs a branch to start with), because it doesn't care what branch you branch from (or merge into). It's only when you get into the broader ecosystem tools like Github that you really start seeing this paradigm, at which point, it's fully configurable.

 

Default works for me 😁

 

As far as I know, the issue is not with the word master but with the word slave. I'm not sure why you see git's master as the kind of master/slave relationship.

To me, git's master is more of a master/copy:

master

 

Git's master is historically tied to master/slave. It got the name from BitKeeper.

Source here

 

Not quite. That was an interpretation, based on quite a lot of inference ('probably'). On the other hand, the guy who actually came up with the term says he meant it as in 'master copy': twitter.com/xpasky/status/12722807...

FWIW he also suggests that the BitKeeper history might also be valid.

Given the fact that I don't remember why I called a thing that thing 6 months later, wouldn't surprise me if that were the case. It's also possible that both were the case: master, the word, came from BitKeeper, and he also learned that it meant something else.

Yes, you are right. I later learned that the git team were thinking and using 'master/slave' terminology for repos around that time.

 

Fair enough. If you look at bitkeeper's documentation though, it refers to master as the master repository. In git, all repos are equally important, it is hard to see when we normally use a server (eg. github) as the source of truth. But in reality all repos are their own master. If anything git freed all the slaves, hehe.

I hear your point. But the master/slave denomination is still quite common is technology. Even if it is rarer these days. The history is there and even if the meaning has changed or time has passed or whatever, if there is a slight chance that this will be interpreted as master/slave ( like it is today ), it should go away.

UPDATE my comment grew into a proper post, 8 problems with replacing "master" in Git.

The comment below is only kept for historical purposes. PS: congrats to the OP for taking more time to think about this issue and keeping their post for accountability.


Why exactly should it go away? Because one sensitive soul out there doesn't have a bit of self-control and chooses an interpretation you have no control over?

Did you mean to oppress anyone when you simply used a word that had become standard?

Words have multiple meanings. "Drug" can get you in jail, or save your life. Should you never use "drug" again because a cop might interpret "I need a drug for pain" as you seeking fentanyl, not aspirin?

There's always going to be someone offended or triggered by anything. Choosing an interpretation of a word with multiple meanings is just that, a choice.

To me, "master" comes from the records industry, where you had a master record/CD and made copies. I don't see why I should mess up all my git workflow and scripts for the purely theoretical slavery interpretation of the word by nobody who will ever use my private repo, and why all git tutorials and articles should become invalid because "master" is now demonized.

Has anyone ever actually complained about this word for git branches?

 

But who knew that that was the origin? I remember the days of The appallingly-named master & slave device controllers, but had no idea that the same terminology was originally in git.

 

The problem here is those originals are not meant to be changed; a new version can be made but it never really replaces the master. And there should only ever be 1 master copy. thus implies this branch should never be touched. But that is rarely the use case for the primary branch.

I like main for the primary branch's name; it doesn't imply anything more than "this is the primary source to use".

 

You can create new masters out of old masters. Which is exactly what git does. Same for other types. You grab all the masters from recording a movie and produce a master for the actual movie. You edit it for the dvd version and you get the master for the dvd version...

The fact that it gets updated doesn't make it let of a master. Deployments get copied from there and can't (shouldn't) modify the code. And it is at any given time the source of truth for your project.

Having said that, I don't really mind how we call it. I'm not against changing the name. It is just a convention. If it was for me, we can call it potato 😅

I'm aware that you can do that; my point is that the terminology doesn't imply that for a lot of people, myself included.

When I think of a "master" copy, I think of the original manuscripts for something like the Iliad. We're not meant to change that copy because it serves as the source of truth for the Iliad story. Once you change it you have a new copy with a new "master" version that doesn't replace the old (unless it's a verbatim copy). In git though, that new version becomes the master copy.

But I'm glad you are open to change though, I actually don't see the full association with master/slave either tbh. I just don't think the name made much sense to begin with, thus if it also makes some people uncomfortable then there isn't much of a reason to keep it. 🤷🏻‍♀️

I think the misconception comes from interpreting master as a single entity. The difference with the master for a book is that copies are meant to be the same book. If your book is a modified copy of the Iliad, it is a master for its own version of the Iliad. What your describe in git is not copying, is creating new Iliads. We add more stuff and create a new master for others to make copies of. Which is the most recent master.

The reason to keep master is cost mainly. Cost of changing all the tools, hours lost trying to figure out why some script doesn't work or why some tutorial doesn't make sense. EVERYTHING has a cost. Even keeping it has a cost, a different kind though. Is it worth it? I don't really know. This article is the first time I've encountered this concern, without digging a bit more I don't know if it is a shared concerned or just someone creating a problem from nothing... 🤷‍♂️

To reiterate, I'm not against the change. I just think it is good to understand NOTHING is free.

 

"production" also sounds clearer..

So you could have

development -> staging -> production

 
Sloan, the sloth mascot Comment marked as low quality/non-constructive by the community View code of conduct

Except master isn't always production. Not every project has a production.

It's really ironic a white, French man decided his was the voice to push for this.

 

You don't need to agree with him..

But I'm more fascinated by the vehemence with which some people find it necessary to refute him.

If you don't like it.. fine.. don't do it.

Sloan, the sloth mascot Comment marked as low quality/non-constructive by the community View code of conduct

It is important to refute him because it's ignorant and token and accomplishes nothing.

 

I applaud your positive intent behind this.

Oftentimes in tech we consider our industry as "advanced" and yet we haven't done enough to be inclusive. And yet our history has been far from perfect in this regard.

 

Thank you! It's a very small step and the absolute minimum I can do. Hopefully, these little steps start a conversation and we will all learn and get better ❤️

 

Tech has done more than any other industry to be inclusive. Kids in Africa or India have $100 laptops where they can learn anything that we've put up online. Countless open-source software has enabled anyone, anywhere in the world, with absolutely no regard for race or ethnicity or anything like that, to do word processing and browse the Internet without paying anything to Microsoft. Crypto can liberate us from banks and government oppression (to talk about true oppression). Etc.

By being distributed over a medium where no names or faces are necessary, software is as inclusive as possible.

 

Yet changing a branch name is so hard?

The change is simple, but the implications are non-trivial and will cause far more pain than we think it may prevent.

Then maybe just do it on new repos going forward? I doubt I will go back and rename every repo I have going back ten years but I'm thinking for new projects why not? No one should be forced to do this but it's not a bad idea.

And BTW, I am 56 and was recording music back in the day on analog "master" tapes so I get what you mean by master tape or master pressing for vinyl but I have no problem using main or trunk as a branch either...

 I'm thinking for new projects why not? 

Let's say a person is new to open source, he/she searches google for tutorials about how he/she can contribute to open-source projects. All the tutorials will have the master mentioned. This will be really confusing for them. If they are new to open-source and computer science In particular, This will surely be a pushback for them.

Actually I would say if this is confusing for them they may want to look for another career... This is about as trivial as things will get for a developer. I'm sure in their Google search they will see a few results that discuss the renaming of branches for this reason. :)

Let's say a person is new to open source, he/she searches google for tutorials about how he/she can contribute to open-source projects. All the tutorials will have the master mentioned. This will be really confusing for them.

Because nothing ever changes and we don't have any references to old and obsolete and failed-to-launch tech anywhere, amirite?

 

Super great post. I think this hits on all of it, and yeah the bitkeeper history is there, but also the existence of master/slave terminology in software in general sort of helps imply that even if git stopped explicitly saying “slave”.

Software needs to be flexible and evolve. It’s kind of the whole point.

 

Exactly, our goal should be to change norms to make people feel more welcomed and to have a more inclusive environment. This is the least we can do.
In terms of low-hanging fruit, I think it doesn't get any easier.

Might not be much, might not do a whole lot, it's certainly not the last thing we should do, but it's so easy and effortless that it should be a no-brainer.

 

I have never heard "slave" in discussions about source control ever; especially git. At least not until we decided we needed to change it.

I always thought of master as "law and gospel" in terms of this is the source of truth for the repository. Where the word originates or how it was used in what git was "built from" is not relevant, language changes over time.

The problem with lots of the suggestions, "unstable", "production", etc. They are all specific use cases for specific workflows. Master is not specific to anything but clearly states what the branch is for. Branching strategies in source control is an entire religion by itself.

I do think that "principle" as suggested in the OP is better... or "main", "root", "default"... but I still feel it is unnecessary to move away from a master branch. I won't enumerate all of the practical problems with moving away from master as many others already did a great job at that.

 

The Git Development Community is working to at least make the name of the main branch easily configurable, so in not so far future having "main" or "trunk" branch instead of current default of "master" from git-init / git-clone would be much easier.

 

Flexibility like this is critical for the health of software development in general. IMO this is a good stress test on software maintainability in general.

 

The Git Development Community is working to at least make the name of the main branch easily configurable

What's wrong with it now?

mkdir /tmp/git-init && cd $_
git init && git checkout -b main
git commit -m init --allow-empty
git branch -a
git log --oneline
 

As far as I remember, changing the default branch would be able to be done with command line parameter or a configuration variable

git init --default-branch=main

or

git config branch.default main
# ...
git init
 

Please tell me you're being facetious...

Why would I be? It's as easy as specifying the branch name in your checkout command to change what your default is.

Because you asked what was wrong with a 7-step init process, in response to someone mentioning that the git developers are working on making it a configuration option.

It's not a seven-step process, though, that was just a complete example for illustration. It's as simple as:

git init
git checkout -b main

Or, we can just do

git config --global init.defaultBranch main

once, and never have to worry about it again.

We also don't have to worry about alias syntax, which is terminal-type-dependent, and can include it in provisioning/dotfiles repos and it works regardless of the person's system. :)

This option was, as far as I know, not available at the time of writing the blog post in question, and possibly also when I was writing my comment.

It wasn't available yet (though it was already in the pipeline). I was responding to Max, whose response suggested that the addition wasn't necessary and the then-current workflow was sufficient.

Even if the latest release (with this config option) hadn't been out when I responded with the config, I still would have argued in favor of having it as a config option, with the same arguments of being able to set it once and not have to worry about terminal aliases, etc.

Do as you please, this isn't Facebook. Is a friendly community. Sarcasm on a touchy subject isn't going to get you anywhere. About 90% of your comments are immature as hell, so therefore I rest my case.

 

I've been thinking about the name since this discussion recently started, and it occurred to me that there's another reason why master (as well as main, primary, trunk, etc.) aren't really appropriate for the default branch.

One of the main design intentions of Linus Torvalds while he was developing git is to be nothing like subversion. svn uses trunk, with the idea that everything else "branches" out from there. git is not like that. In fact, "branch" is a poor choice of words for git, because it implies that there is a trunk, however, in git, there is no trunk at all. There's nothing special about the default branch. It's just another branch. They just needed a name for the first branch. But they were thinking in terms they were used to, like in BitKeeper, or Subversion. So, they called it master, reasoning that it would be the primary branch. But, it's not the primary branch, it's just the first one.

And in hosted git repos, like GitHub, the "default" branch is simply whichever branch HEAD points to. That's what GitHub does when you change your default branch: it just points to whichever one you specify. And when you clone a repo from a remote source, unless you specify otherwise, your local HEAD will start whatever HEAD is on the remote.

People use git like that (with a tree-like branching pattern), though, so it works for most people. But not everyone uses git like that. There are plenty of projects that maintain multiple primary branches, mainly to keep development going on older versions.

So, with the idea that really every branch is just a branch, they should, ideally, be named according to their function. So, my suggestion is that the "default" branch would be prod, or production. That way, it's clear that this branch has production-ready code. If you follow the git flow style, this makes sense anyway. You do most of your work in develop and feature branches, and merge into prod when it's ready.

 

That way, it's clear that this branch has production-ready code

What if it's not code that I'm keeping in my repo? For example I kept my master principal thesis in git. At that time, still in school, I felt no connection to the word prod at all. I think the premise for this discussion is absurd, but if I had to pick a new word, it would have to be as generic as possible. I think main works well.

 

"As generic as possible" would probably be "default", because that's all it is. It's the default branch.

It might be for production code. It might be for in-development code. It might be for documentation. It might be for something completely different.

Folks using git should choose a name for their first branch that accurately reflects what the branch is being used for. That way it's not ambiguous.

And if you're using it just for yourself, and not using it for collaboration, so it doesn't matter what you call it, call it whatever you want. It doesn't affect anybody else. It only has to have meaning to you.

 

What if it's not code that I'm keeping in my repo?

While "production" may not be a 100% accurate word (and is why different people have different ideas for the default name), the concept is still the same -- that's the rendition that's going to ultimately go to the final audience (be it client computers or bookshelves).

Weirdly enough, all of this disagreement could be solved by making the default branch name a config option...

 

The FAT32 partition should be changed as it is triggering for those struggling with body issues.

 

Should we also stop talking about "THIN" clients because that might offend super models - and they have emotions too ... although you wouldn't think so judging by their emotionless facial expressions as they strut the catwalk :)

Maybe we should also ban the use of the word 'model' in software ... it can be taken out of context.

 

You've done absolutely nothing wrong in bringing this up, so please don't apologize. Thank you for trying to advocate for positive change. It's everyone's responsibility, regardless of color, gender, or nationality.

Some of the negative responses you got on this thread are absolutely beneath the standard of conduct for DEV.

Please keep speaking up for diversity and inclusion! Next time you get attacked like this, don't hesitate to click the three little dots (...) and both Hide Comment and Report Abuse. You have the right to keep conversations on your articles healthy and inclusive...and that means you have the right to be intolerant of intolerance.

 

I remember when I first heard this terminology, I couldn't believe it was a thing in software!
I think renaming master to main makes the most sense, since that's how it is explained anyway.

 

"Master" is a term from the recording industry. I'm not a native English speaker so it was strange to me too, but in American English "master" has been far more commonly used in the past 50 years to talk about vinyl records and CDs, or having a "Masters of Science" or being a "master of the guitar" than slaves. Words change meaning over time.

 

but in American English "master" has been far more commonly used in the past 50 years to talk about vinyl records and CDs...

Not in the computer industry.

Until the past decade or so, the "master/slave" terminology was alive and well and even the default meaning of "master" in this context, even if "slave" wasn't explicitly mentioned.

It was even engraved on hard drives until the early 2000s (until the early-mid 2000s, BIOS software would commonly look for bootloaders on any and all drives hooked up, unless jumpers on the physical drives were set to "master" and "slaves" -- or more accurately, the OS drive and data drives).

You can find the discussions had by several of the database organizations and adjacent groups about renaming the hub-and-spoke architecture from "master/slave" to something else.

Words change meaning over time.

They do, but in this case it's not a change of meaning. "Master" still means "overseer of subordinates" as one of its definitions.

The meaning, in this case, hasn't changed. The word is overloaded -- it has several definitions, not unlike overloaded methods in C# or Java (which is why the "Master of Science" thing is an absurd and bad-faith argument, because it's using a different definition of the word).

This overloading is actually an argument in favor of changing it, because there are many words to choose from that better describe the default branch and aren't overloaded -- both of which make the meaning more clear.

 

Thank you for writing this tutorial.

 

First of all: I'm not disagreeing. I do believe that words have power and influence the way people think. I am not presenting an argument in the form of a question: I'm actually asking a question in an attempt to understand.

What is an oppressive metaphor?

It's people who oppress, not words, so it can't be a metaphor that oppresses. Maybe it's a metaphor that refers to a system of oppression. However, that can be said of a term like "landlord" as well, which does not seem to be a problem for most people. The main difference seems to be how long ago that system was in effect and how long it's been given time to take on a different meaning (of course, by not using the term because of its oppressiveness, we're not giving it any (more) time to take on a different meaning). Are these things that matter in determining whether or not a term is oppressive?

Maybe it has to do with whether or not people are bothered by a term. I mean, it makes a lot of sense to me to avoid using a term that bothers people. But for every term you will probably be able to find someone who is bothered by it, so you'll have to make it something like "a lot of people" are bothered by the term. But from what I've gathered, people seem to care more about the connection with slavery than whether or not a lot of people are bothered by this term.

Once again, I'm not saying that we shouldn't move away from terms like "master/slave". I'm not even saying that it's not an oppressive metaphor. I'm actually interested in your view as to what makes an oppressive metaphor or term.

 

Does 'master' always imply a corresponding 'slave' and hence always have slavery connotations?

At school, with no people of African origin at the school, in each year we had a teacher who was referred to as "the year master" but nobody ever thought that it related to any slavery concept. We just thought of him as the dude that was in charge, of us, and we were definitely not his slaves.

In git I've seen 'master' branch used universally but never once heard of other branches being called or ever referred to as 'slave' branches by anyone, ever.

Too bad if anyone has ever conceived a "Masterplan".

It must hurt to be "MasterCard" right now... VISA just scored a free home run!

The only IT concept I have heard of where master/slave is used is hardware redundancy - e.g. database replication where there is a 'master' database with one or more 'slave' databases to which data is replicated.

I can see a definite issue with that usage. Perhaps that concept should be renamed 'origin/clone' - which is actually a much more accurate description in any case. A 'clone' database's sole purpose is to become a perfect clone of the origin database - which is actually not at all like a master/slave relationship. So even people who are not offended by the use of the master/slave term should be disturbed by it's inaccurate depiction of the concept the term is trying to identify.

 

No. The word "master" does not always correspond to "slave". I have a Master's degree. That does not mean that I've made a slave of a subject. A master of a recording does not imply that there are slave recordings, but copies. MasterCard does not mean that it is for slave owners. Master plan just means it's either the main plan or a darn good one.

English is a strange language. One word can have many different meanings, and very different words can be spelt in the same say (e.g. to "lead" a group" or a "lead" pipe"). Let's not go overboard with a shotgun approach to censoring different words that happen to look and sound the same. The master/slave usage in tech is and has always been toxic and offensive. Let's just stop calling Jenkins worker nodes slaves. A git master branch does not have the same connotation.

 

I think that changing a word does not make any difference, actions make difference I live in a dictartorship and for over 5 years I used to work under conditions you could consider enslaving earning under 5$ per month for 13 hours of work while I was learning how to code and got my first job with a cheap laptop. I believe that if we can take actions to help people who live under real circumstances of slavery, we could make a difference, not changing the name of our branches for god sake

 

I commend you .. must have been awful..

 

Thanks, Yeah it was awful, but I'm grateful that it ended I'm still recovering physically after a year

 

It's not an either-or thing.

People can "take actions to help people who live under real circumstances of slavery" and change their branch names to something less inflammatory and more descriptive.

 

This is totally politics.

I believe, many of these people voting to replace 'master' from git use credit cards. And somehow they are quite ok to use MasterCard.

And that is something, that they use every day, and something, that other people see them use

 

Yet another person not "getting" it. It's not ever single word with master in it. It's the history of the connotation of master in Tech like hard drive and controller master/slave wording. Even though it looks like this is not the case in the original Git naming why not use something else? Simple change...

 

Do we have slave branches in git?
It is just the only word, same as in mastercard, master's degree, master-whatever-else.

So did you even read my last reply? Anyway, name your branches whatever you want. I'm not sure why people are pushing back on this so hard. It's not that difficult to understand.

Sure I did.
Let me put it in other words: there is no slave in git, 'master' in git not originating from an offensive "master/slave wording". It is just a single word same as in master's degree, mastercard, etc.
Something originating from 'master copy'.

Github competitor, Gitlab, was first to enrol into this renaming stuff. They've decided to change white-list and black-list terms. Well, ok, this could sound offensive.
Github had to act too.

I'm pushing on this, cause I see just politics here. this change will not improve anyone's life. There are other better things to worry about.

Reading this post I got really curious to find more about if the word master in git had relation with the master/slave terminology in tech. If you go to github.com/git/git, clone it and run git log -p --grep=slave, you'll see it does.

So yes, there is slave in git and it comes from master/slave wording. ¯_(ツ)_/¯

Ok, you rename that poor master branch
But what you gonna do with this?
github.com/search?q=slave

I'll do nothing at all. I just argued against your paragraph where you strongly said that the term's origin wasn't related to something, but it is, without providing sources. Which words people choose to have in their repositories/codebase is something that might reflect on their careers not mine. So, ask them.

 
 

I think everyone agrees that changing might be the a right move (for other reasons). But none of the proof provided anywhere suggest the origins are truly proven, as far as I am concerned. Maybe the person that first committed that had a different notion altogether. Personally when it comes to other usages (databases) the references are clear. Here they are not, what the proof provides is that certain people are tempted to use it with the wrong context.

 

As English is not my native language, the usual main branch name has no other connotation to me, I don't even know what bitkeeper is, and I never found out someone having a problem with that, so I'll continue to use the standard "master" wording unless the repo owner uses whatever official denomination works better for it.

 

Seriously, I know you seem to see this as "blowing up". But it does so for a reason. We all need to take a deep breath and get back to reality. If we start on this path of picking words which would not offend someone, we would really not have that many words to pick from. "Principal" can be just as offending to someone as "master". Git was not written during the time of slavery, so it's context to "master" and "slave" in a slavery context is just moot.

This is just a silly storm in a water glass.

Seriously guys, get a grip. (Oh sorry! I might have offended the women in the audience by saying that.)

 
 

As per this creator's comment:
twitter.com/xpasky/status/12722807...
It's as "master copy" so it's a "solution" to a non-existing problem.

Also let me join this comment from a person that is targeted by this change.

 

It's a shame that everyone ignored this.
This is yet another case of a bunch of white people putting themselves in front of a PoC cause and making it about them. They fail to see the absurdity inherent in telling PoC people what should offend them. They just jump in front with a megaphone and seize control. Their default behavior is so built around consuming they don't even realize when they're doing it. Then when someone speaks up, they eat their own.

Where are the black voices in the conversation? They're being ignored and drowned out by the white voices driving the discussion with a low effort display of "solidarity" while the rest of us are out in the streets protesting daily for real, meaningful change.

If you're not black, your place is BESIDE or BEHIND this cause. You lack the fundamental experience to lead the cause.

 

Thanks for finding and posting that! It's an excellent point and I've reused it in my response. The OP doesn't offer any evidence of any black Git user actually being offended by the word "master". The problem may be completely imagined, but the pain caused by changing the word will be very real.

 

You linked to Petr Baudis explaining that he named it after "master recording", but you conveniently ignored the post earlier in the thread where he, himself, said that he is glad that it's being changed: twitter.com/xpasky/status/12714774...

I also have some doubt that he, all by himself, chose that name. Yes, he was part of the git core team at the time and made several commits to the code. But the particular commit that made "master" the default name for the first branch was made by Linus himself. And he probably had other reasons for choosing "master", regardless of what Petr was thinking.

 

... And, as Linus himself is a Finnish guy, with English being not his first language, and himself being not from the American-raised culture, I'm pretty sure he wouldn't create this name to promote slave culture

He might not have been aware at the time. That's totally reasonable. It's also possible that he was aware, and didn't care, because Linus is kind of a jerk.

He might be kind of a jerk (he is, to be honest, although he's better now), but there is a difference between being a jerk and being a racist piece of shit. Also, racism is not that much proponent in Europe nowadays, and not a thing people have their minds on in general.

(disclaimer: personally I don't feel a connection between word master and slavery. for the first 16 years of my life master was an HDD you put at the end of your IDE cable.)

Absolutely. To be clear, I was not trying to suggest that Linus is a racist. I was suggesting that he might be insensitive to those who are impacted by racism, but not that he himself is racist.

And again, I don't know if that's the case. I'm not trying to accuse him of anything in particular. It's completely possible that, if he chose the word, he chose it for no reason other than it was a familiar word to him, and it seemed reasonable, and he wasn't particularly concerned about it.

According to Petr Baudis, Petr himself chose the name. It's possible he made the suggestion to Linus, and Linus didn't care enough about what it was called and went along with Petr.

I'm not sure we'll ever know exactly how the name was chosen. It was 15 years ago. All the people involved in the development may not all remember exactly what happened perfectly.

But, in this discussion, it probably doesn't matter why it was chosen. More than that, what matters is what it means to people today.

 

Thank you for making the only legitimate comment to this ridiculous topic.

 

@damcosset just curious. Do you vouch for replacing the terms master record in music, master's degree in academia and the saying "easy to learn, hard to master" in gaming? Or is this limited to master branch?

 

The dense bullshit I read here on dev.to on a daily basis is overwhelming. We might as well ban chess, because it commonly comes with black and white figurines. Ok, so we exchange it with red and yellow... What? These are also culturally connected to some skin color tones? dang.. lets take triangles and circles but in all blue and hope that nobody is offended. What? That might offend obese people because they connect their shape with the shape of the figurines? And they don't want to have king and queen because that is transphobe? This is getting tricky. We might be able to ship a set of "kings and queens" and people can choose what gender or if any any of their playing inventory has.

Ugh. I hate to get myself in an argument like this one, but seriously I have no clue where to draw the line. People should stop taking themselves so seriously. Life is short, have fun.

 

Oh how lovely..dev.to automatically adds a heart to my own posts, so I don't feel so lonely.. We raise a world where we only have "winners", "loved by everyone". The self implied facade we keep up to not crush our little helpless egos is mind-boggling.

 

So go to a different platform if it bothers you so much.

Which one?
medium.com is abusing its authors free time and energy to make money out of them.
echojs.com is okayish. They try hard to not get flooded with ads.
hashnode.com and dev.to is full of political and SJW articles. Sprinkled in with array method articles and beginner articles.
And then there are author platforms that
hackernoon.com has decent content, but I can also more or less compare them to medium, when it comes to the money making machinery.

I'm best off looking for individual blog posters hosting their own website, because platforms are never going to be the solution. I am happy if bloggers are advertising their own products on their own website - as long as they do it decently.

Or just follow the individual people that you prefer to read. No one says you have to read every single thing posted on a given platform.

That said, LiveJournal and its ilk are still going strong. Wordpress.com has a lively community. The Mastadon network is probably bound to have something (and most people don't limit themselves to a single post for things, and if nothing else, it's a fantastic place for discovery). And, like you noted, a great many people have their own websites and aren't even on these platforms.

The point still stands, though -- no one's forcing you to stay here. If you don't like the content (or, as the case is with Medium -- which I agree -- the business practices), then "vote with your feet" and find somewhere that better fits what you're looking for.

Or hell, start your own platform for yourself and those whose values align with yours. Then you can set the rule, get the content you want, provide a service for your niche, and depending on how you go about it could even have it pay for itself or pay you (if you want).

thanks for your input :) you are right.

 

And what are we doing with orphan branches? I feel bad for somebody growing up without parents.

Furthermore, let's rename the default remote ("origin") to "mirror". I don't want to be categorized by "origin".

Let's just do that right!

 

Worst is to have a detached HEAD, many people died by guillotine...

 

my-little-pony it is then

Some comments have been hidden by the post's author - find out more

Code of Conduct Report abuse