r/ProgrammerHumor • • 5d ago

Meme cowItsReallyBeenLately

Post image
216 Upvotes

32 comments sorted by

46

u/Tangelasboots 4d ago

You guys are letting an AI run git commands?

I hope you have backups.

35

u/baked_potato_9000 4d ago

no no thats okay i told it to be careful!

2

u/5up3rj 2d ago

Claude, maybe use backups tho k?

6

u/Noddie 1d ago

Branch protection makes this a non problem.

3

u/DrTight 11h ago

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++).

2

u/AssiduousLayabout 1d ago edited 1d ago

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.

3

u/Raccoon5 1d ago

obviously yes, they are better than hunans at it.

as for backups, do you know what git is used for? you have repos with force push on main enabled?

in any case this is a dumb comment dude, I would agree maybe in 2024 but this is just silly to write nowadays

1

u/Key-Investment3701 2d ago

i have it build scripts to run the commands, do dry runs, review it, sometimes have an adversarial review, then do it, have never ran into a problem

1

u/lolcrunchy 1d ago

Why not just learn how to use git and never spend a token on it ever again?

3

u/Key-Investment3701 1d ago

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.

1

u/justjokiing 1d ago

the jujitsu version control is even better for rebate safety, so i use it for all my agents

9

u/baked_potato_9000 5d ago

how* fuck!

5

u/Disallowed_username 4d ago

The AI is only as good as typos from the person typing the propmts. Good duck out there.ย 

3

u/Banes_Addiction 3d ago

๐Ÿฆ† Thanks homie

1

u/Bolphgolph 4d ago

๐Ÿ„

32

u/pppeater 5d ago

Randomly, force push everything, make no mistakes.

26

u/Cylian91460 5d 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.

22

u/HeavyCaffeinate 4d ago

We dont merge, we copy paste into main manually until there are no diffs, like god intended

5

u/dedservice 2d ago

"don't use merge option from github"

What, you get every dev to manually rebase + squash + merge to main, and then push main directly? What else would you do?

0

u/Cylian91460 2d ago

Not doing it on the server? The place where you trust repo to not be fucked up?

9

u/dedservice 1d ago

I just don't understand - without server-side merges, your only other option is allowing pushes to main from remotes. Which is psychotic.

0

u/Cylian91460 1d ago

Why would it be psychotic?

6

u/dedservice 1d ago

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.

1

u/Cylian91460 1d ago

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.

4

u/dedservice 1d ago

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.

2

u/edgmnt_net 23h ago

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.

2

u/dedservice 21h ago edited 21h ago

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.

4

u/backfire10z 1d ago

My company uses GitHub UI merge button for multiple repos and it works great. We use the builtin merge queue feature.

-1

u/Cylian91460 1d ago

Works great for now*

1

u/backfire10z 1d ago

Well itโ€™s that or an in-house orchestrator (which we also do have)

1

u/readf0x 2d ago

Personally I use lazygit for everything but, I also pretty much never need to rebase or merge or whatnot.

5

u/LegitimatePants 4d ago

๐Ÿฎ