this post was submitted on 04 Apr 2024
1115 points (98.1% liked)

Programmer Humor

19623 readers
4 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 213 points 7 months ago (8 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 117 points 7 months ago (1 children)
[–] MargotRobbie@lemm.ee 79 points 7 months ago (2 children)

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

[–] errer@lemmy.world 29 points 7 months ago

She’s modest too!

[–] sundray@lemmus.org 19 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 54 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 40 points 7 months ago (1 children)

This is why Sydney Sweeney isn't on Lemmy.

[–] Klear@lemmy.world 15 points 7 months ago

She probably is, just anonymous. It would be crazy to expect anyone to post on lemmy under their real name.

[–] DudeDudenson@lemmings.world 17 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 52 points 7 months ago* (last edited 7 months ago) (3 children)

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

  • Benjamin Franklin
load more comments (3 replies)
[–] Jax@sh.itjust.works 25 points 7 months ago

But esteemed Academy Award nominated character actress and film director, Margot Robbie, if it's unlikely that Hollywood actress Sydney Sweeney said this... wouldn't it be just as unlikely that Margot Robbie would be here? Adding her own comment?

... are you projecting? Is there something you want to tell us esteemed Academy Award nominated character actress and film director Margot Robbie?

load more comments (4 replies)
[–] PP_BOY_@lemmy.world 92 points 7 months ago (13 children)

Why is anyone using X in 2024?

[–] hddsx@lemmy.ca 198 points 7 months ago (2 children)

I do, I have yet to switch to Wayland

[–] CanadaPlus@lemmy.sdf.org 38 points 7 months ago (2 children)

It's called Twitter now, by conservation of names. /s

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

I use X because Cinnamon on Wayland has no option to change the keyboard layout

load more comments (1 replies)
[–] T156@lemmy.world 18 points 7 months ago (1 children)

Wayland really doesn't like RDP/remote access, so X is the only way to go if you want that to work properly.

load more comments (1 replies)
[–] Theharpyeagle@lemmy.world 16 points 7 months ago (4 children)

I tried it for a moment, made games stutter like hell, switched back. I know I need to go in and figure it out at some point, but it's hard to muster the energy when X, for the most part, works fine.

From what I've seen, it probably has to do with my Nvidia GPU.

load more comments (4 replies)
load more comments (9 replies)
[–] 13@kbin.run 66 points 7 months ago* (last edited 7 months ago) (7 children)
[–] wise_pancake@lemmy.ca 86 points 7 months ago

History is written by the squashers.

[–] magic_lobster_party@kbin.run 23 points 7 months ago (1 children)

Imagine working with a tangled spaghetti of history

load more comments (1 replies)
load more comments (5 replies)
[–] cyborganism@lemmy.ca 51 points 7 months ago* (last edited 7 months ago) (8 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 18 points 7 months ago (4 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 21 points 7 months ago (14 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.

load more comments (14 replies)
load more comments (3 replies)
load more comments (7 replies)
[–] tengkuizdihar@programming.dev 43 points 7 months ago (8 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.

[–] nialv7@lemmy.world 20 points 7 months ago (1 children)

That was you! I remember this.

[–] tengkuizdihar@programming.dev 23 points 7 months ago (1 children)
[–] bear@slrpnk.net 31 points 7 months ago

There's 102 people mentioned in that commit and two of them happen to meet in the comments of a meme thread on Lemmy of all places. I love the Internet.

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

ITT: people who have no idea how rebasing works.

[–] magic_lobster_party@kbin.run 30 points 7 months ago (11 children)
load more comments (11 replies)
[–] Zagorath@aussie.zone 25 points 7 months ago (4 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?

[–] loutr@sh.itjust.works 17 points 7 months ago* (last edited 7 months ago) (6 children)

She's an ~~Australian~~ American actress who blew up last year (she was in euphoria I think?), expect to see her in a ton of upcoming blockbusters.

[–] MargotRobbie@lemm.ee 15 points 7 months ago (2 children)

You are probably thinking of another talented blonde Australian actress.

load more comments (2 replies)
[–] Conyak@lemmy.tf 14 points 7 months ago

She is from Spokane Washington not Australia. She got a lot of recognition for her role in Euphoria and is blowing up a bit right now because she is a young, attractive, talented actress.

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

Rebasing is for noobs.

git reset head~42
git push -f
load more comments (1 replies)
[–] Crow@lemmy.blahaj.zone 20 points 7 months ago (2 children)

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

[–] andrew@lemmy.stuart.fun 52 points 7 months ago* (last edited 7 months ago) (29 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 13 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)
load more comments (28 replies)
[–] BlackPenguins@lemmy.world 20 points 7 months ago* (last edited 7 months ago) (4 children)

Merge is taking all the code from the master branch and combining it with the task branch, resulting in a commit for just the merge itself.

Rebase is "re-basing" where your task branch was created from off the master branch. It essentially takes all the commits from master that happened since you branched, REWRITES THE HISTORY of your task branch by inserting those master branch commits before all your existing commits, and effectively makes your task branch look like it was branched yesterday instead of like 4 weeks ago. You changed where your task branch originated on the master. You moved its base.

Atlassian does a fantastic writeup on this.

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

Did she just tell people up git good?

[–] jjjalljs@ttrpg.network 16 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)
[–] Croquette@sh.itjust.works 16 points 7 months ago (2 children)

I know this is a meme post, but can someone succinctly explain rebase vs merge?

I am an amateur trying to learn my tool.

[–] jaemo@sh.itjust.works 23 points 7 months ago (18 children)

Merge keeps the original timeline. Your commits go in along with anything else that happened relative to the branch you based your work off (probably main). This generates a merge commit.

Rebase will replay all the commits that happened while you were doing your work before your commits happen, and then put yours at the HEAD, so that they are the most recent commits. You have to mitigate any conflicts that impact the same files as these commits are replayed, if any conflicts arise. These are resolved the same way any merge conflict is. There is no frivolous merge commit in this scenario.

TlDR; End result, everything that happened to the branch minus your work, happens. Then your stuff happens after. Much tidy and clean.

load more comments (18 replies)
[–] letsgo@lemm.ee 18 points 7 months ago (3 children)

Merge gives an accurate view of the history but tends to be "cluttered" with multiple lines and merge commits. Rebase cleans that up and gives you a simple A->B->C view.

Personally I prefer merge because when I'm tracking down a bug and narrow it down to a specific commit, I get to see what change was made in what context. With rebase commits that change is in there, but it's out of context and cluttered up with zillions of other changes from the inherent merges and squashes that are included in that commit, making it harder to see what was changed and why. The same cluttered history is still in there but it's included in the commits instead of existing separately outside the commits.

I honestly can't see the point of a rebased A->B->C history because (a) it's inaccurate and (b) it makes debugging harder. Maybe I'm missing some major benefit? I'm willing to learn.

[–] reflectedodds@lemmy.world 16 points 7 months ago* (last edited 7 months ago) (4 children)

I feel the opposite, but for similar logic? Merge is the one that is cluttered up with other merges.

With rebase you get A->B->C for the main branch, and D->E->F for the patch branch, and when submitting to main you get a nice A->B->C->D->E->F and you can find your faulty commit in the D->E->F section.

For merge you end up with this nonsense of mixed commits and merge commits like A->D->B->B'->E->F->C->C' where the ones with the apostrophe are merge commits. And worse, in a git lot there is no clear "D E F" so you don't actually know if A, D or B came from the feature branch, you just know a branch was merged at commit B'. You'd have to try to demangle it by looking at authors and dates.

The final code ought to look the same, but now if you're debugging you can't separate the feature patch from the main path code to see which part was at fault. I always rebase because it's equivalent to checking out the latest changes and re-branching so I'm never behind and the patch is always a unique set of commits.

load more comments (4 replies)
load more comments (2 replies)
[–] sirleonelle@sh.itjust.works 15 points 7 months ago (2 children)

I'll go one further: use git rebase --interactive

[–] natecox@programming.dev 21 points 7 months ago (6 children)

I remember learning about how to use this back in the day and what a game changer it was for my workflow.

Today I like to do all of the commits as I’m working. Maybe dozens or more as I chug along, marking off waypoints rather than logging actual changes. When I’m done a quick interactive rebase cleans up the history to meaningful commits quite nicely.

The fun part is that I will work with people sometimes who both swear that “rewriting history” is evil and should never be done, but also tell me how useful my commit logs are and want to know how I take such good notes as I go.

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

Argh. I hate that argument.

Yes - "Rewriting history" is a Bad Thing - but o argue that's only on 'main' (or other shared branches). You should (IMHO) absolutely rewrite your local history pre-push for exactly the reasons you state.

If you rewrite main's history and force your changes everybody else is gonna have conflicts. Also - history is important for certain debugging and investigation. Don't be that guy.

Before you push though... rebasing your work to be easily digestible and have a single(ish) focus per commit is so helpful.

  • review is easier since concerns aren't mixed
  • If a commit needs to be reverted it limits the collateral damage
  • history is easier to follow because the commits tell a story

I use a stacked commit tool to help automate rebasing on upstream commits, but you can do it all with git pretty easily.

Anyway. Good on you; Keep the faith; etc etc. :)

load more comments (1 replies)
load more comments (5 replies)
load more comments (1 replies)
load more comments
view more: next ›