News for hackers. Stuff that matters.
Re:Software Engineering at Google (2017) by sigsergv on Friday January 04, 2019 @06:03AM (#18823177)
I think they don't branch code because perforce branches are horrible and merging them back to HEAD is extremely painful process for monorep.
Re:Software Engineering at Google (2017) by StreamBright on Friday January 04, 2019 @06:42AM (#18823328)
Even git or hg branches are horrible. Once you have multiple people working on the same codebase and touching the same files it is pretty horrid to manage. I know several companies not using branches because the merge conflict resolution takes too much time.

The PDF explicitly calls out the time consuming part:

"Almost all development occurs at the “head” of the repository​, not on branches. This helps identify integration problems early and minimizes the amount of merging work needed. It also makes it much easier and faster to push out security fixes."

Re:Software Engineering at Google (2017) by sigsergv on Friday January 04, 2019 @09:05AM (#18824087)
Rebased branches in git are nice (for one developer only unfortunately), there are some pain of course but when rebase is performed often (once a day) it consumes not so much of time. The real pain begins when some huge commit is pushed to HEAD but it still manageable.

Anyway, I feel sad that so much efforts were put on really nice VCS concepts and almost no one use them in enterprise development.

Re:Software Engineering at Google (2017) by dilyevsky on Friday January 04, 2019 @12:52PM (#18826040)
Google havent been using p4 since around 2013
Re:Software Engineering at Google (2017) by sigsergv on Friday January 04, 2019 @01:05PM (#18826158)
Piper interface and workflow is heavily influenced by perforce.
Re:Software Engineering at Google (2017) by dilyevsky on Friday January 04, 2019 @01:59PM (#18826652)
Except it’s now highly scalable that is taking care of branching performance. Nothing technically making it difficult to branch afaik. In fact rapid (grape) used it pretty heavily to track rollouts if I remember correctly.
Re:Software Engineering at Google (2017) by raverbashing on Friday January 04, 2019 @06:14AM (#18823210)
So, use a better tool?
Re:Software Engineering at Google (2017) by philosopher1234 on Friday January 04, 2019 @06:18AM (#18823224)
Or, don’t branch. Is branching so essential?
Re:Software Engineering at Google (2017) by lordnacho on Friday January 04, 2019 @06:27AM (#18823257)
Isn't it essential for mental organisation? How do you think about what's different about a set of changes without some sort of DAG?
Re:Software Engineering at Google (2017) by username90 on Friday January 04, 2019 @05:41PM (#18828427)
They are grouped by linking them to issues in the issue tracker. All commits will then get a link to the issue and the issue gets a link back to the commit. This way you can easily track and read the full context of old changes.

Example issue, note that public ones are not associated with commits: https://issuetracker.google.com/issues/122326181

Re:Software Engineering at Google (2017) by yjftsjthsd-h on Friday January 04, 2019 @08:18AM (#18823748)
Just do one thing at a time? Today, I am working on X; my commits are for X, and details are in the commit message.
Re:Software Engineering at Google (2017) by dharmab on Friday January 04, 2019 @08:53AM (#18824016)
That breaks as soon as you have to interrupt working on Nice To Have Feature X to working on Inportant Bugfix/CVE Y.
Re:Software Engineering at Google (2017) by addicted on Friday January 04, 2019 @10:28AM (#18824630)
How often does that happen to an individual developer though?

Once a month? In an averagely well run company even that may be towards the higher end.

Should your entire development strategy be based on a once a month occurrence?

Re:Software Engineering at Google (2017) by idontpost on Friday January 04, 2019 @01:18PM (#18826274)
> Once a month?

Closer to once a week for me.

Re:Software Engineering at Google (2017) by hopler on Friday January 04, 2019 @08:02AM (#18823659)
Make one change at a time.
Re:Software Engineering at Google (2017) by raverbashing on Friday January 04, 2019 @06:30AM (#18823269)
If you don't want to be stuck while a colleague does changes that conflict with what you're changing then yes, you need branching.
Re:Software Engineering at Google (2017) by hknd on Friday January 04, 2019 @06:50AM (#18823360)
You don't need branching for this.

If 2+ people are working on the same file which might result into a conflict, you can either: - handle the conflict as soon as you merge your branches somewhen in the future or - handle it when trying to commit your change to head

Only difference is whether you handle the conflict now, or in the future.

Re:Software Engineering at Google (2017) by hopler on Friday January 04, 2019 @08:03AM (#18823666)
You need to communicate with your colleagues to coordinate your work.
Re:Software Engineering at Google (2017) by StreamBright on Friday January 04, 2019 @06:42AM (#18823332)
What do you mean? Branching is not a solved problem once people are editing the same files.
Re:Software Engineering at Google (2017) by ashelmire on Friday January 04, 2019 @07:38AM (#18823555)
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.

Re:Software Engineering at Google (2017) by sigsergv on Friday January 04, 2019 @09:09AM (#18824112)
Sometimes one-line commit could cause merging conflict that requires hours of communications. Or even days in distributed teams.
Re:Software Engineering at Google (2017) by StreamBright on Friday January 04, 2019 @08:12AM (#18823714)
Sure, 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.

Re:Software Engineering at Google (2017) by ashelmire on Friday January 04, 2019 @08:28AM (#18823817)
What 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.

Re:Software Engineering at Google (2017) by yitosda on Friday January 04, 2019 @10:02AM (#18824445)
I 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.