progit2
progit2 copied to clipboard
Discussion point: master terminology
I've had a look but can't see this already discussed - apologies if it has.
With Microsoft/GitHub recently discussing the removal of terms such as "master/slave"/"whitelist/blacklist" from their systems, including Github, could or should the term be review and/or removed from the Git Book and replaced with a term such as "main"?
I appreciate this would be a large task so might have to be done in stages.
(I've also raised this for discussion on the git-scm issue list https://github.com/git/git-scm.com/issues/1487)
I'm absolutely on board with this kind of effort, and I'd love to take steps towards removing this terminology. There are parts of this which are under our control, and parts that are not. Until Git changes the default branch name (or lets you customize it for git init
), the word "master" will need to continue to appear in the text.
Here are the things we can do in the meantime:
- Add a note that describes how to set the default branch name
- ...using a template repo for
git init
- ...using
git branch -m
for existing repos
- ...using a template repo for
- Explicitly change the branch name when doing
git init
in examples - Assume the remote branch name is not "master" for examples with cloned repos
We do need to be careful to protect the newbie experience though. I don't want someone to get frustrated because they ran git init
and the example text assumes that the fresh default branch is called main
with no explanation.
It turns out that changing from master
to main
is not as hard as it appears:
-
git branch -m master main
-
git push -u origin main
- Then change the default branch in GitHub settings for the repository.
- Change settings for continuous integration (Travis, GitHub Actions, Azure Pipeline).
So that takes care of the problem if you're only using the repository as a backup for your own work.
If you collaborate with others, the people with a fork/clone will need to make some changes too:
git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
Yeah, running git init
from your local terminal will still give a master
main branch.
Making a new repo from within GitHub also still gives a master
branch as of today.
I don't know when GitHub themselves will use the main
branch if you create a new repository from within their interface.
The starter GitHub Actions have just been rejigged to use a "$default_branch" token instead of a hard-coded master
branch.
So there is work done on migrating away from master
at least.
Sources:
https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx https://github.com/actions/starter-workflows/pull/590