AI is also extrem powerful in solving merge or rebase conflicts. In Our Company project which werde 5 developers working constantly i let AI rebase a branch where the whole logging framework is Switched. Over 30 commits whith 700 files touched (c++).
As long as you haven't configured your git repository with an insanely short garbage collection window, it's almost impossible barring physically removing the .git files from the repository's disk to lose a previous commit entirely, at least not without giving you an ample period to identify and fix the issue.
Rebasing and force pushing a branch doesn't delete the prior state of the branch. It creates an entirely new branch of commits and points the branch descriptor at the new branch. The old commits will remain there until garbage collected, just under a SHA-1 reference instead of your branch name. By default you have between 30 and 90 days before the old reference expires, and then another 2-week grace period before it actually gets pruned and garbage collected. And if you tagged the old branch, it would never expire or be pruned.
And any sensible repo won't allow force pushing to main, so at worst you clobber a feature branch.
Iโve been using git since it came out when I had to move all of our work in subversion over to it. There are some reasons why having scripts execute git commands can be helpful, like when migrating repos or doing complicated merges and maintaining a record of exactly what was done, or for building ci/cd pipelines. And having ai generate scripts saves time.
Are you really suggesting to let your devs push directly to your main branch? In a medium sized team with 20 commits per day, that's a massive opportunity for horrific mistakes. I would guess that the odds of github screwing up the merge+push are literally ten million times lower than one of your devs doing the same.
Allowing remote doesn't mean allowing all remote, that would be hell
Doing the merge on local rather then server man you can 1 check before push to see if there's something wrong and 2 in case something goes wrong it stay in local and not break the repo that is trusted to be working
You merge on local for the same reason you don't directly push to prod.
How big is the largest team you've worked on, in terms of number of developers per repo? I don't believe that anyone who worked on a properly large project would actually think this was a good idea. No work would get done. Merging is automatic and completely safe when done by the server, I've never even heard someone so much as express concern that it might be a problem. Like, what is there to go wrong other than a hardware issue on github's side? Conflicts already block merges, changes get squashed and rebased, CI gets run so all your tests pass before you start to merge, I don't know what you would even check to see if "something went wrong". Like "in case something goes wrong" - genuinely, what is going to go wrong? git itself is not going to break all of a sudden and all other issues I can imagine are code issues, not merge issues.
The Linux kernel has thousands of contributors per development cycle and they do just fine with an even stricter version of that (separate maintainers each doing their own thing and taking patches from ICs and someone higher up merging on a massive scale).
Merging is definitely not completely safe, actually, and some form of automatic conflict resolution may occur. Mismerges happen.
Anyway, there are reasonable arguments beyond that why some/many projects might be better off fostering stricter version control practices and a truly distributed workflow. IMO, companies misuse Git far too often and oftentimes out of sheer ignorance rather than as a calculated tradeoff. In fact companies are far more likely to hit hard limits very early on, like not being able to accomodate more than 5-10 people per repo, because they don't know what they're doing.
Ah, you're saying that the issue is essentially when you send a PR to merge, then there could be automatic conflict resolution based on changes made in the meantime? Yeah, but you just disable that and enforce a strict merge queue that doesn't let PRs get merged unless none of the same files have been changed in the meantime. I agree that automatic conflict resolution has a reasonable chance of being an issue. But again, no more so than someone doing it locally and not really thinking about it too hard.
I actually disagree with the flat statement "mismerges happen". They just don't. What would that look like? Two PRs edit file A off of main at commit 634, then they both get approved, one gets merged after the other, automatic conflict resolution happens and makes a mistake in the second one because the lines don't line up as expected so the diff doesn't apply cleanly? Sure, but again, any sane repo maintainer disables automatic conflict resolution and will just kick the second PR back to review automatically saying that merging would generate conflicts, so please rebase first. What else would a mismerge look like?
Edit: and to your final point, I work somewhere with 100+ developers that regularly commit to each of a couple repos, we get dozens of PRs merged per day, and nobody has had an issue with server-side merges; pushes to main are disabled for everyone. There are many open source repos with much higher stats than that. vscode has over a hundred per day on average, for instance. Just because the kernel devs insist on doing it the 2005 way doesn't mean that way is better.
61
u/Tangelasboots 22d ago
You guys are letting an AI run git commands?
I hope you have backups.
10
u/baked_potato_9000 23d ago
how* fuck!
34
u/pppeater 23d ago
Randomly, force push everything, make no mistakes.
29
u/Cylian91460 23d ago
Daily remember to 1 not trust git gui and 2 don't use merge option from GitHub, merging on the server is a very good way to break everything.
5
u/LegitimatePants 22d ago
๐ฎ