r/programming • • Jun 14 '20

GitHub will no longer use the term 'master' as default branch because of negative association

https://twitter.com/natfriedman/status/1271253144442253312
3.3k Upvotes

2.4k comments sorted by

View all comments

Show parent comments

30

u/Hrothen Jun 14 '20

Any script or tool that assumes the default branch in anything but a brand-new repo is named master would already be incredibly brittle. It's not like it's uncommon to have a different name, dev probably being the most common.

2

u/Izzyanut Jun 15 '20

Shields is an extremely stable project, that is used in a large amount of repos that by default will assume master is the default branch. You can specify another branch but it defaults to that for users that do use master. That's just one example, currently it seems if the change from master is made, it is likely going to break backwards compatibility for them, and anyone that uses the badges they generate.

2

u/flying-sheep Jun 15 '20 edited Jun 15 '20

Their API assumes “master” to be the default branch name, which is false. Git can ask a repo for the default branch name, and does so on first clone. Repos using another default branch name already have to specify that branch name. Optimally the only thing that changes is that their UX gets a bit nicer for people who don’t use the default default branch name, and that readmes from now contain shields.io URLs that specifically mention branches.

2

u/Cheueue Jun 15 '20

How would you determine which branch is the primary branch? master the default branch for git repositories and is a sensible guess. People who go out of their way to do something custom will have the necessary knowhow to deal with tools that expect a master.

What github did here was force all developers who don't have that knowhow to deal with this issue as well.

I wonder how many man-hours this shortsighted decision will end up wasting.

2

u/flying-sheep Jun 15 '20

Git determines the default branch name of a remote repo on first clone. Whoever assumes arbitrary 3rd party repos to have a branch called “master” (or even for that branch to be the default branch) operates under false assumptions, i.e. writes broken code.

You could e.g. ask Git to give you the default branch name like this.

What github did here was force all developers who don't have that knowhow to deal with this issue as well.

Good. If they control the repo creation and branch names, nothing will change. If they don’t, their scripts are already broken, they just haven’t encountered a repo that makes them hit that bug yet.