On Git branch naming
What’s happening? #
A configurable option is being added to the Git version control software, to GitHub, and to other systems associated with Git.
The option will let you configure what you want as the default branch name for the primary source code branch in newly created repositories.
The default value for the name of the primary branch hasn’t been decided yet, but popular options include “main” and “trunk”.
No existing repository will be affected.
Until now, the software always named the initial branch “master” by default, but it has always been possible to rename or remove that branch.
Why is this being done? #
There are at least two reasons why this is being done.
Firstly, the term “master”, and the “master/slave” metaphor, is seen as potentially offensive to some people.
Secondly, the term “master” makes no sense, as masters don’t have branches. Instead, a term taken from a railway line metaphor (“main”) or a tree metaphor (“trunk”) would be more consistent and likely less confusing.
The developer who picked the term “master” says he regrets it and wishes he had picked “main” instead.
This is just political correctness #
No, some people have been confused by the use of the term “master” for a branch within a repository, rather than the more normal use of the term as the name of a server to which data is replicated. (I was one of them until this whole debate flared up.)
It just means master copy #
The term “master” was copied from the BitKeeper version control software that Git was written to replace. In BitKeeper there is no separate concept of a branch; you have a master repository and slave repositories, and branching is done by setting up a new slave of the master.
This was explicitly the Git model in the early days of development. Quoting Linus Torvalds in 2005 (rewrapped here):
What does that mean? It means that in a mirroring schenario,
you can, for each git tree, do:
(a) On the slave:
cat .git/refs/*/* | sort | uniq > slave-ref-list
(b) On the master:
cat .git/refs/*/* | sort | uniq > master-ref-list
(c) On the master:
cmp $master-ref-list $slave-ref-list && exit 1
list=$(cat master-ref-list)
for i in $(cat slave-ref-list)
do
list=$list ^$i
done
git-rev-list --objects $list
and now that "git-rev-list" will list every object that needs
to be copied from the master to the slave. No need to read
huge directories etc, you get the list computed for you.
So while Git no longer has a master replica and slave replicas, that wasn’t the case originally, and the term does derive from a master/slave metaphor.
I don’t find it offensive #
Neither do I, but that’s not the point. There are a lot of things I don’t find offensive that still aren’t appropriate in a business context.
But master is the standard term #
Other version control software uses different terminology.
Monotone uses globally unique branch names based on DNS (there’s always one, isn’t there?)
I could go on, but the point is: Git is an odd one out, because of its history as an emergency replacement for BitKeeper.
The word Git is offensive too #
Yes, good point, we should probably rename Git too. Why not suggest it to Linus?
This will break lots of code! #
Remember that no existing repository will be affected, so no existing code will be broken.
There is probably code which assumes that the user won’t have renamed the initial default branch, but if so then that code is already buggy and should be fixed. There were already projects using ‘dev’ or some other name for their main development branch.
What about freedom of speech? #
You’re free to configure your software to keep using ‘master’ as the default branch name for new repositories. In fact, you’re free to use overt racial slurs as your branch names if you really want to.
This is a US problem, the rest of the world shouldn’t have to care #
A history of slavery is not a problem unique to the US.
When Britain passed the Slavery Abolition Act in 1833, it spent 40% of the country’s total tax income that year on reparations…for the slave owners. It was such a massive bailout that the country didn’t finish paying off the borrowed debt until 2015.
Belgium had slavery in the Belgian Congo. France was involved in the Caribbean slave trade. Holland was involved in slavery. Spain too. Oh, and Germany, obviously. Australia had slavery of indigenous people as well as being a recipient of slaves when it was a penal colony. Brazil had 300 years of slavery. And slavery is still not a crime in nearly half the world’s countries.
If you think your nation has nothing to do with slavery, you’re probably mistaken.
But this isn’t going to end racism or slavery #
Nobody’s suggesting it will.
You should do something meaningful #
It isn’t an either/or. It’s possible to change the default branch name in your new software repositories and do other things too!
Personally, I’m a strong advocate for buying slavery-free chocolate and direct trade coffee, and for companies trying to end slavery in their supply chains.
No, sorry, this is all just stupid and trivial #
If it’s really so trivial, why are so many people spending so much effort arguing against it? The sheer amount of time spent arguing against such a minor change is evidence that changes in vocabulary do, in fact, matter.