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
 
top 50 comments
sorted by: hot top controversial new old
[–] MargotRobbie@lemm.ee 130 points 7 months ago (5 children)

I think this is a fake quote that somebody made up for an Internet comedy bit, since it seems unlikely for Hollywood actress Sydney Sweeney to have such uncharacteristically strong opinion on software version control, of all things.

Because she of all people would know that there isn't anything wrong with using git merge, and it ultimately comes down to personal preference to what you are used to.

[–] archomrade@midwest.social 69 points 7 months ago (1 children)
[–] MargotRobbie@lemm.ee 48 points 7 months ago (1 children)

That's esteemed Academy Award nominated character actress Margot Robbie to you!

[–] sundray@lemmus.org 12 points 7 months ago

And successful Hollywood film producer -- props on getting into the stakeholder end of the business so early in your career!

[–] Artyom@lemm.ee 35 points 7 months ago (2 children)

Margot Robbie, I was about to agree with you and thought that was a very reasonable take, until you tried to argue that git merge is better than git rebase, then I simply had to disregard the whole thing.

[–] MargotRobbie@lemm.ee 21 points 7 months ago

This is why Sydney Sweeney isn't on Lemmy.

[–] DudeDudenson@lemmings.world 11 points 7 months ago

But they were arguing that it's personal preference not that one is better than the other

[–] beeng@discuss.tchncs.de 29 points 7 months ago* (last edited 7 months ago) (2 children)

"Don't always trust what you read on the internet."

  • Benjamin Franklin
load more comments (2 replies)
[–] Conyak@lemmy.tf 4 points 7 months ago* (last edited 7 months ago)

I mean, it’s posted in programming humor so yeah.

load more comments (1 replies)
[–] 13@kbin.run 47 points 7 months ago* (last edited 7 months ago) (2 children)
[–] wise_pancake@lemmy.ca 58 points 7 months ago

History is written by the squashers.

[–] magic_lobster_party@kbin.run 17 points 7 months ago

Imagine working with a tangled spaghetti of history

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

Please for the love of god don't use merge, especially in a crowded repository. Don't be me and suffer the consequences. I mistakenly mention every person with a commit between the time I created the branch until current master.

[–] Atemu@lemmy.ml 5 points 7 months ago (2 children)

Merge is not the issue here, rebase would do the same.

load more comments (2 replies)
[–] cyborganism@lemmy.ca 32 points 7 months ago* (last edited 7 months ago) (4 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 (5 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 (2 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.

load more comments (2 replies)
load more comments (4 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.

load more comments (2 replies)
[–] RustyShackleford@programming.dev 4 points 7 months ago (1 children)

Git-~~illeterate~~ illiterate

load more comments (1 replies)
load more comments (2 replies)
[–] expr@programming.dev 25 points 7 months ago (1 children)

ITT: people who have no idea how rebasing works.

[–] magic_lobster_party@kbin.run 20 points 7 months ago (1 children)
[–] CmdrKeen@lemmy.today 11 points 7 months ago (1 children)

No doubt. git rebase is like a very sharp knife. In the right hands, it can accomplish great things, but in the wrong hands, it can also spell disaster.

As someone who HAS used it a fair amount, I generally don't even recommend it to people unless they're already VERY comfortable with the rest of git and ideally have some sense of how it works internally.

[–] expr@programming.dev 5 points 7 months ago (8 children)

Yeah it is something people should take time to learn. I do think its "dangers" are pretty overstated, though, especially if you always do git rebase --interactive, since if anything goes wrong, you can easily get out with git rebase --abort.

In general there's a pretty weird fear that you can fuck up git to the point at which you can't recover. Basically the only time that's really actually true is if you somehow lose uncommitted work in your working tree. But if you've actually committed everything (and you should always commit everything before trying any destructive operations), you can pretty much always get back to where you were. Commits are never actually lost.

load more comments (8 replies)
[–] RonSijm@programming.dev 17 points 7 months ago

Rebasing is for noobs.

git reset head~42
git push -f
[–] Crow@lemmy.blahaj.zone 14 points 7 months ago (1 children)

I've been using merge, and I hate that I don't even know what rebase really does

[–] andrew@lemmy.stuart.fun 31 points 7 months ago* (last edited 7 months ago) (3 children)

Merge takes two commits and smooshes them together at their current state, and may require one commit to reconcile changes. Rebase takes a whole branch and moves it, as if you started working on it from a more recent base commit, and will ask you to reconcile changes as it replays history.

[–] pineapple_pizza@lemmy.dexlit.xyz 8 points 7 months ago (3 children)

This diagram seems wrong to me. Isn't the second image a squash merge? Also why would rebasing a feature branch change main?

load more comments (3 replies)
[–] xilliah 5 points 7 months ago (2 children)

I'm relatively new to git and rebase looks like a mess to me? Like it appears to be making duplicate commits and destroys the proper history?

If you use rebase to get a more readable history, isn't the issue the tool you use to view the history?

I guess I have to try it out a few times to get it.

[–] Ephera@lemmy.ml 5 points 7 months ago (3 children)

What you probably mean by duplicate commits is that it assigns new commit IDs to commits that have been rebased. If you had already pushed those commits, then git status will tell you that the remote branch and your local branch have diverged by as many commits as you rebased.

Well, and what is the "proper history"? If your answer is "chronological", then why so?
For the rare times that it matters when exactly a commit was created, they've got a timestamp. But otherwise, the "proper history" is whatever you make the proper history. What matters is that the commits can be applied one after another, which a rebase ensures.

When you're working on a branch and you continuously rebase on the branch you want to eventually merge to, then the merged history will look as if you had checked out the target branch and just made your commits really quickly without anyone else committing anything in between.
And whether you've done your commits really quickly or over the course of weeks, that really shouldn't matter.

What is really cool about (supposedly) making commits really quickly is that your history becomes linear and it tells a comprehensible story. It won't be all kinds of unrelated changes mixed ~~randomly~~ chronologically, but rather related commits following one another.
And of course, you also lose the merge-commits, which convey no valuable information of their own.

load more comments (3 replies)
load more comments (1 replies)
[–] Crow@lemmy.blahaj.zone 5 points 7 months ago (1 children)

That's pretty cool, might actually do that. Tho, we currently don't use the history as much anyways, we're just having a couple of small student projects with the biggest group being 6 people. I guess it's more useful if you're actually making a real product in a huge project that has a large team behind it

[–] RecluseRamble@lemmy.dbzer0.com 4 points 7 months ago* (last edited 7 months ago) (10 children)

Just remember to not combine it with force push or you're in for some chaos (rewriting history team members have already fetched is a big no-no).

load more comments (10 replies)
[–] Zagorath@aussie.zone 13 points 7 months ago (2 children)

Okay this is the second time I've seen Sydney Sweeney referenced in a meme in less than half a day. I had never heard of her before. Who is she, and why is she suddenly attracting so much meme attention?

[–] Strawberry@lemmy.blahaj.zone 7 points 7 months ago* (last edited 7 months ago) (1 children)

She's an American actress who was in Handmaid's Tale and a few other things and then blew up thanks to her role in Euphoria. She's become a bit of a meme recently because online conservatives think that her boobs are anti-woke

load more comments (1 replies)
[–] FriendBesto@lemmy.ml 4 points 7 months ago

Two reasons.

[–] jjjalljs@ttrpg.network 13 points 7 months ago (9 children)

I used to only merge. Now I rebase. The repo is set up to require squash and rebase when going to main.

All the garbage "spelled thing wrong" and "ran formatter" commits go away. Main is clean and linear.

load more comments (9 replies)
[–] hitmyspot@aussie.zone 12 points 7 months ago

Did she just tell people up git good?

[–] jollyrogue@lemmy.ml 9 points 7 months ago (1 children)

git rebase is only for terrorists. 🥸

Also for me when I’ve been drinking and committed some really stupid shit into the repo. No one needs to know what I really think of my team members.

[–] 7heo@lemmy.ml 5 points 7 months ago (1 children)

Yeah totally merge everything, people like a good spaghetti salad.

load more comments (1 replies)
[–] lightrush@lemmy.ca 7 points 7 months ago (1 children)
load more comments (1 replies)
[–] rimjob_rainer@discuss.tchncs.de 5 points 7 months ago

Daily circlejerk

[–] JoYo@lemmy.ml 5 points 7 months ago (2 children)

Anyone mind explaining to me how git rebase is worth the effort?

git merge has it's own issues but I just don't see any benefit to rebase over it.

[–] Jesus_666@feddit.de 12 points 7 months ago* (last edited 7 months ago) (2 children)

I use interactive rebases to clean up the history of messy branches so they can be reviewed commit by commit, with each commit representing one logical unit or type of change.

Mind you, getting those wrong is a quick way to making commits disappear into nothingness. Still useful if you're careful. (Or you can just create a second temporary branch you can fall back onto of you need up your first once.)

load more comments (2 replies)
load more comments (1 replies)
[–] tatterdemalion@programming.dev 4 points 7 months ago (2 children)

Rebase feature branch, merge commit into main (NO SQUASH).

load more comments (2 replies)
[–] cupcakezealot@lemmy.blahaj.zone 4 points 7 months ago

i like to create ten different checkouts of main, rebase them all slightly differently and then no fast forward merge them all back into each other

[–] nullPointer@programming.dev 4 points 7 months ago

do it often. you may end up with 150 conflicts to have to wade through.

load more comments
view more: next ›