GitHub announced that starting from October 1, 2020, all source code repositories created on the GitHub platform will be named main by default instead of the original master.
Recently, GitHub announced that from October 1, 2020, all source code repositories created on the GitHub platform will be named main by default instead of the original master.
What is the reason for this change? What are the specific changes? Next, answer them one by one for you.
Replace terms such as master, the open source project is in action!
On June 12 this year, a Twitter by Google Chrome developer Una Kravets went viral, suggesting that GitHub replace master with neutral terms like main, and explaining the reason for this suggestion:
- main is shorter, concise and clear;
- Easy to be remembered
- Will make my teammates feel comfortable;
- Will not allow blacks to feel discriminated against in the technology sector;
The CEO of GitHub responded: “The proposal is very good, and we are already implementing it.”
ZDNet once said Continued use of racially colored vocabulary may deepen racial discrimination, which is really worrying. Some scholars also believe that these terms not only reflect racist culture, but also strengthen, legitimize and perpetuate it. “Because the “Black Lives Matter” movement in the United States has intensified, the technology community has once again set off a wave of deleting such words in source code and software application development.
Therefore, GitHub stated in June this year that the company is working to replace the word master with neutral terms like main to avoid unnecessary associations with slavery. The specific replacements are: master and slave will be replaced with main/default/primary and secondary, whitelist and blacklist will be replaced with allow list and deny/exclude list.
In addition to GitHub, Android mobile operating system, Go programming language, PHPUnit and Curl have all expressed their intention to replace blacklist/whitelist with neutral words. Similarly, the OpenZFS file storage manager has replaced the master/slave terms used to describe the relationship between storage environments with appropriate words.
At the same time, some well-known open source projects in the industry also changed the name of their default Git repository from master to alternative names such as main, default, primary, and root.
However, it is worth noting that the name modification of open source projects is not as simple as imagined. In June of this year, the developer of React Refresh Webpack Plugin quickly changed master to main, but was complained by a programmer: Because in the Git context, the usage of the word master is different from master/slave, which caused all programs to be changed. Finally The project collapsed.
It can be seen that modifying the name of the default branch of the repository is not a matter of overnight, it needs to be done step by step. This is just like the content of the recent GitHub official announcement: from October 1st, main will be used instead of master, but it will be carried out in stages.
GitHub replaces master with main, and developers are most concerned about it.
GitHub and the huge Git community are considering renaming the default branch name of the source code repository, and GitHub chose to replace master with main as the default branch name of its own repository, and will change it in several stages to make the most of it. May reduce damage to existing projects.
GitHub recommends users: If you have not renamed the default branch, you can consider waiting until the end of this year. We are investing in development tools to rename the default branch of an existing repository to provide a seamless experience for maintainers and contributors.
Here are some notices announced by GitHub in this regard:
- Updated GitHub.com: Redirect the original link containing the name of the deleted branch to the corresponding link in the new default branch of the repository;
- Updated GitHub Pages: you can build and deploy from any branch;
Note: Publishing to a special gh-pages branch can still work as before, but now you can choose any other branch in the repository as the publishing source.
- Added user, organization, and enterprise settings: set the default branch name for all newly created repositories on GitHub.com.
These settings cover repositories created through GitHub.com and GitHub API. Git 2.28 adds a similar setting to control the default branch used when running git init on the command line. You can learn more about the new init.defaultBranch setting in the Git 2.28 blog post.
GitHub Desktop will also introduce default branch settings for new repositories later this month.
October 1, 2020: Newly created repositories will default to main
From October 1, 2020, newly created repositories will use main as the default branch instead of the original master. But this change will not affect any existing repositories: existing repositories will continue to retain the same default branch as before.
Why choose main instead?
main is the most popular alternative to master seen on GitHub. And the vocabulary of main is very short, allowing users to form good muscle memory; it is also easy to translate in many languages.
GitHub is currently using main for newly created repositories and repositories that are being migrated, such as dependant-core.
End of this year: seamless migration of existing repositories
Renaming the default branch will definitely cause a lot of trouble for existing repositories:
- Opening a pull request requires relocation to a new branch
- Draft release needs to be relocated to a new branch
- Branch protection strategy needs to be transferred to new branch
Before the end of this year, GitHub will seamlessly rename all existing repositories to their default branches. When the branch is renamed, GitHub will relocate the unfinished PR and draft version, the protection policy of the mobile branch, etc.-all will be implemented automatically. And, GitHub is also considering redirecting users of the old branch name of git fetch or git clone to the new branch name (with warnings and instructions to update their local clones).
Thoughts on this move
In fact, the political correctness of computer terminology is not a topic that has only emerged in recent years, and GitHub’s replacement of master under the supervision of the public is not the first to bear the brunt.
As early as 2004, master/slave was rated as one of the ten least politically correct words of the year by the global language testing agency, but the software development and network development at that time were not as developed as they are today, so changing the terminology is a matter of It’s all spontaneous. For example, in 2008, the open source software Drupal announced that it would rename master/slave to client/server on the grounds that it would be inappropriate to continue to use offensive terms when there are better alternatives. Until 2018, the IETF proposed in the draft that open source software needs to change the two expressions of master/slave and blacklist/whitelist, and the use of computer terminology has attracted widespread attention.
Therefore, in the same year, many developers began to call on open source software vendors such as Redis, Google, and Python to modify related terms.
But in fact, there have been many voices of opposition. The two most important reasons are:
- Words such as master and blacklist in the computer source code do not contain ethnic colors;
- The cost of the change is too great.
In fact, what those proponents are pursuing is not that the word “black” cannot be used at all, but rather that “biack” should not be used as the opposite of “white” to convey the negatives of “bad” and “need to be restricted”. meaning. Therefore, when master/slave appears in the code, it happens to express the “master-slave” relationship, which inevitably makes people think of slavery.