The fundamental tenets for Linux kernel maintenance
In August, 2020, Linus Torvalds just released Linux 5.8-rc5. Over 100 coders contribute to this release with over 14,000 commits and about 800,000 lines of code.
From the last release, Linux 5.7, it has been only two months. What surprises everyone is such a huge Linux project could run in an orderly manner for over 30 years. This is because for the Linux project the developers always follow the fundamental tenets.
1. One commit for only one thingOne commit is for one thing and only. It does not have to be small, but it has to be a change on a single task. This could help the project maintainer to identify and separate any change that is not right while not affecting other functions.
2. Commits cannot break the buildEach commit should be independent, fully functional, and not cause regressions. For example, a change to a function’s prototype must also update every file that calls it, so it could prevent the build from breaking.
3. All code is bisectableA bisect is an operation like a binary search algorithm that allows you to find the exact point in time which goes wrong and which is important. This only works well if you abide by the previous rules that each commit is for only one thing.
4. Never rebase a public repositoryThe Linux workflow process won’t allow you to rebase any public branch used by others. Once you rebase, the commits that were rebased will no longer match the same commits in the repositories based on that tree.
5. Git gets merging rightGit was structured to merge code from different branches compared to other change management systems. It figures out and resolve conflicts effortlessly and saves a huge amount of manual work.
6. Keep well-defined commit logsA well-written changelog for that code change can help review codes as well as help maintainers determine if that code can be removed or how it can be modified.
7. Run continuous testing and integration
Before sending a pull request upstream, the committer should test it. Running continuous testing and continuous integration would help integrate them correctly and reduce integration problems. It also assures the quality of the project.
All of these practices enable the Linux community to release incredibly reliable code for the Linux kernel at such a massive scale. I hope this blog could inspire you on the way you maintain your projects.