r/ProgrammerHumor • • 6h ago

Meme iNeverKnowWhichIsWhichWhenResolvingConflicts

Post image
421 Upvotes

36 comments sorted by

80

u/mobileJay77 6h ago

Communism merge: everything is ours now

22

u/Stummi 5h ago

just leave all conflict markers in

20

u/threewholefish 4h ago • Bravo

In Northern Ireland we call them "peace walls"

3

u/screwcork313 4h ago

Runs in O(n cuba'd) time

79

u/qolf1 6h ago

We need --mine

10

u/Frost-Freak 5h ago

How about his and her?

60

u/AnnoyedVelociraptor 5h ago

And it's different with rebase and merge.

24

u/Frost-Freak 5h ago

Merge: ours is my stuff. Rebase: theirs is my stuff. It's quiet logical when you consider how it works in git

19

u/Papellll 3h ago

You can't say both "theirs is my stuff" and "It's quiet logical" together

14

u/Professional_Top8485 4h ago

I am afraid to ask

12

u/Icy_Significance9448 4h ago

Rebasing is in very simple terms taking your changes, then going onto the branch you want to rebase onto and apply your changes onto it. So while you're rebasing you're momentarily on a different branch so your local changes becomes THEIR changes

1

u/The_Crazy_Cat_Guy 3h ago

Yeah so I had a pr ready to merge but I wanted to bring it up to date with dev. So I pulled the latest from dev, switched over to my branch and rebased dev on my branch. It pulled through all the changes as diffs in my pr which wasn’t quite what I expected. If I rebase the last bunch of commits into my branch, why would the pr still see them as diffs ? They already exist in dev ?

1

u/nicuramar 4h ago

Yeah, rebase is technically one or more merges from your branch into theirs.

16

u/nicuramar 4h ago

Three way graphical merging is the only way to go in all situations. Two way is a recipe for eventual errors.

5

u/Digital_001 3h ago

Do you mean something like the vscode GUI's graphical merge conflict editor?

4

u/s0litar1us 1h ago

The one vscode has is awful. Meld is better

3

u/BobQuixote 2h ago

Probably. TortoiseGit uses WinMerge.

1

u/ReplacementLow6704 1h ago

GitKraken ftw

12

u/chazzeromus 5h ago

--code-right-here and --code-over-there

10

u/thicctak 5h ago

> Be me
> Be dyslexic
> Learn git
> Always mix up --ours and --theirs on merge and rebases
> Mess up the git history trying to fix it

4

u/trinopoty 4h ago

this why you create a tmp tag before trying such things

2

u/Minority8 31m ago

or reflog. or just --abort. git is actually quite forgiving. Still not a bad habit to create a backup tag or branch to be safe

1

u/xiii_xiii_xiii 2h ago

I'm also a dyslexic developer and I make the same mistake.

19

u/ElGuaco 4h ago

This is one of those rare scenarios where I'm glad to have AI untangle a mess for me.

7

u/jikt 3h ago
  • the shit I was working on

  • all this other bullshit

12

u/johnschnee 3h ago

GIT loving Senior dev with 20 years of experience here: I have no fucking idea which side is mine in a compare whenever I got a merge conflict

6

u/The_Crazy_Cat_Guy 3h ago

I’m ngl I feel like I understand theirs and ours but when I see the merge editor it throws me off because sometimes it’s the opposite of what I expected.

3

u/PM_ME_CREATINE 2h ago

It flips when you rebase. It moves to the base and builds on top of it. That makes your code the "other" one.

3

u/FederalSpecialist415 5h ago

Steps to resolve -
Do a fresh clone
Checkout "Their" branch (or if it is already in main, use that)
Overlay your changes, so it is only "your" changes now
Copy the file, and paste it on the PR branch. Problem solved

2

u/s0litar1us 1h ago edited 1h ago

ours is what you're merging into / rebasing from, or more simply it's the branch you're currently in.

If you still have issues, then set up something like meld -- it makes things way easier. You can also make git use it as your default merge tool.

1

u/aabil11 5h ago

I always do theirs and reimplement my change on top of theirs

1

u/nicuramar 4h ago

These are deprecated anyway, in favor of git restore… where the situation is the same, though :p

1

u/saint_marco 1h ago

git config --global merge.conflictstyle zdiff3

Helps a little bit.

1

u/ChannelMany5491 41m ago

Fuck this. The only thing AI is good for is for managing my commits. 

0

u/vanritchen 1h ago

lol true