10 ms·
Git is actually pretty good at automatically resolving conflicts within files; unless you edit the same lines, it’s easy. If you do edit the same lines, merging
by ashelmire 8y ago
Git is actually pretty good at automatically resolving conflicts within files; unless you edit the same lines, it’s easy. If you do edit the same lines, merging is pretty straightforward.
This whole conversation the last day or two on HN has been kind of nuts. Like everybody agrees you shouldn’t put all your code in a single file, right? Why not? It would let everyone see all of the source code in one place! But it would be huge and hard to avoid conflicts. So we split things into files. Then “trees”, etc...
Basically it sounds like googles monorepo is really a bunch of repos glued together with changes in one triggering changes in others. The difference, it seems, is that google does not get to benefit from the things OS developers like about git. It’s like google developed custom versions of GitHub, circleci, and other tools and are marketing that as a better solution (just build several billion dollar solutions to manage your monorepo!).
And even after all that, google has a bunch of separate repos for important open source or secret work.
- StreamBright 8y agoSure, so here is a challenge for you. Original file: a = 1 Contributor X: a = 5 Contributor Y: a = 0 Both contributors created a pull request and submitted it. In the description they both state that the new value should be the one they put it. How would you resolve this issue in a timely fashion making sure you do not take down a service accidentally and do not slow down development too much. I intentionally gave you a very simple example but if you want we can go into rolling out new features, fixing security bugs and a lot more where such issues arise. And, no git will never be able to solve these issues. I don't think that HN going nuts (except few zealots) and these problems come from the nature of software development in general. We have seen how Google solves these (monorepo, custom CI/CD, etc. etc.) and there are other companies solving it different ways (maybe have a branching model, using Github). People are just putting out here they experience and based on that and they level of understanding the perceived solutions.
- ashelmire 8y agoWhat does google do? You’re working on a line of code and the trunk changes. Your local no longer aligns with it. You have a conflict. Someone’s changes get committed first. That’s a business decision, not a code tooling one. Second pr has to adjust. Same on both mono and poly repo, just using different words. At least branches let you have the choice, which cannot be said for branchless.
- yitosda 8y agoI think there's a bit of confusion about what exactly Google is doing. IIUC they use (and develop) gerrit. Effectively this workflow means everyone is working on the same branch and the first commit to pass review gets in. The next guy will have to rebase. In the end one wins as you said, but the level of detail is rebasing individual commits, not merging entire branches. So this ends up being the age-old rebase vs merge discussion.
- sigsergv 8y agoSometimes one-line commit could cause merging conflict that requires hours of communications. Or even days in distributed teams.