this post was submitted on 04 Apr 2024
631 points (100.0% liked)

Programmer Humor

421 readers
1 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] cyborganism@lemmy.ca 32 points 7 months ago* (last edited 7 months ago) (3 children)

I prefer to rebase as well. But when you're working with a team of amateurs who don't know how to use a VCS properly and never update their branc with the parent branch, you end up with lots of conflicts.

I find that for managing conflicts, rebase is very difficult as you have to resolve conflicts for every commit. You can either use rerere to repeat the conflict resolution automatically, or you can squash everything. But when you're dealing with a team of Git-illiterate developers (which is VERY often the case) you can either spend the time to educate them and still risk having problems because they don't give a shit, or you can just do a regular merge and go on with your life.

Those are my two cents, speaking from experience.

[–] technom@programming.dev 11 points 7 months ago (2 children)

I agree that merge is the easier strategy with amateurs. By amateurs I mean those who cannot be bothered to learn about rebase. But what you really lose there is a nice commit history. It's good to have, even if your primary strategy is merging. And people tend to create horrendous commit histories when they don't know how to edit them.

[–] agressivelyPassive@feddit.de 13 points 7 months ago (3 children)

Honestly, I'm pretty sure 99.9% of git users never really bother with the git history in any way that would be hindered by merging.

Git has a ton of powerful features, but for most projects they don't matter at all. You want a distributed consensus, that's it. Bothering yourself with all those advanced features and trying to learn some esoteric commands is frankly just overhead. Yes, you can solve great problems with them, but these problems almost never occur, and if they do, using the stupid tools is faster overall.

[–] chamomile@furry.engineer 4 points 7 months ago* (last edited 7 months ago) (1 children)

@agressivelyPassive @technom That's a self-fulfilling prophecy, IMO. Well-structured commit histories with clear descriptions can be a godsend for spelunking through old code and trying to work out why a change was made. That is the actual point, after all - the Linux kernel project, which is what git was originally built to manage, is fastidious about this. Most projects don't need that level of hygiene, but they can still benefit from taking lessons from it.

To that end, sure, git can be arcane at the best of times and a lot of the tools aren't strictly necessary, but they're very useful for managing that history.

[–] agressivelyPassive@feddit.de 4 points 7 months ago (1 children)

I'd still argue, that the overhead is not worth it most of the time.

Linux is one of the largest single pieces of software in existence, of course it has different needs than the standard business crap the vast majority of us develop.

To keep your analogy: not every room is an operating room, you might have some theoretical advantages from keeping your kitchen as clean as an OR, but it's probably not worth the hassle.

[–] chamomile@furry.engineer 0 points 7 months ago (1 children)

@agressivelyPassive You should still clean your kitchen though, that's my point.

[–] agressivelyPassive@feddit.de 2 points 7 months ago

Did I say anything otherwise?

[–] technom@programming.dev 1 points 7 months ago (1 children)

Only users who don't know rebasing and the advantages of a crafted history make statements like this. There are several projects that depend on clean commit history. You need it for conventional commit tools (like commitzen), pre-commit hook tools, git blame, git bisect, etc.

[–] agressivelyPassive@feddit.de 2 points 7 months ago (1 children)

Uuuh, am I no true Scotsman?

Counter argument: why do you keep fucking up so bad you need these tools? Only users who are bad at programming need these. Makes about as much sense as your accusation.

You keep iterating the same arguments as the rest here, and I still adhere to my statement above: hardly anybody needs those tools. I literally never used pre-commit hooks or bisect in any semi-professional context. And I don't know a single project that uses them. And before you counter with another "well u stoopid then" comment: the projects I've been working on were with pretty reputable companies and handled literally billions of Euros every year. I can honestly say, that pretty much everyone living in Germany had his/her data pushed through code that I wrote.

[–] technom@programming.dev 2 points 7 months ago

Uuuh, am I no true Scotsman?

That's a terrible and disingenuous take. I'm saying that you won't understand why it's useful till you've used it. Spinning that as no true Scotsman fallacy is just indicative of that ignorance.

You keep iterating the same arguments as the rest here, and I still adhere to my statement above: hardly anybody needs those tools.

And you keep repeating that falsehood. Isn't that the real no true Scotsman fallacy? How do you even pretend to know that nobody needs it? You can't talk for everyone else. Those who use it find it useful in several other ways that I and others have explained. You can't just judge it away from your position of ignorance.

load more comments (1 replies)
[–] xigoi@lemmy.sdf.org 4 points 7 months ago (2 children)

Why would you want to edit your commit history? When I need to look at it for some reason, I want to see what actually happened, not a fictional story.

[–] Atemu@lemmy.ml 2 points 7 months ago

Because when debugging, you typically don't care about the details of wip, some more stuff, Merge remote-tracking branch 'origin/master', almost working, Merge remote-tracking branch 'origin/master', fix some tests etc. and would rather follow logical steps being taken in order with descriptive messages such as component: refactor xyz in preparation for feature, component: add do_foo(), component: implement feature using do_foo() etc.

[–] technom@programming.dev 1 points 7 months ago

You can have both. I'll get to that later. But first, let me explain why edited history is useful.

Unedited histories are very chaotic and often contains errors, commits with partial features, abandoned code, reverted code, out-of-sequence code, etc. These are useful in preserving the actual progress of your own thought. But such histories are a nightmare to review. Commits should be complete (a single commit contains a full feature) and in proper order. If you're a reviewer, you also wouldn't want to waste time reviewing someone else's mistakes, experiments, reverted code, etc. Self-complete commits also have another advantage - users can choose to omit an entire feature by omitting a commit.

Now the part about having both - the unedited and carefully crafted history. Rebasing doesn't erase the original branch. You can preserve it by creating a new branch. Or, you can recover it from reflog. I use it to preserve the original development history. Then I submit the edited/crafted history/branch upstream.

[–] RustyShackleford@programming.dev 4 points 7 months ago (1 children)

Git-~~illeterate~~ illiterate

[–] cyborganism@lemmy.ca 1 points 7 months ago
[–] magic_lobster_party@kbin.run 3 points 7 months ago (1 children)

How others are keeping their branches up to date is their problem. If you use Gitlab you can set up squash policy for merge requests. All the abomination they’ve caused in their branch will turn into one nice commit to the main branch.

[–] expr@programming.dev 5 points 7 months ago

I don't want squashed commits. It makes git tools worse (git bisect, git cherry-pick, etc.) and I work very hard to craft a meaningful set of commits for my work and I don't want to throw all of that away.

But yeah, I don't actually give a shit what they are doing on their branches. I regularly rebase onto master anyway.