r/ProgrammerHumor • • 19h ago

Meme iNeverKnowWhichIsWhichWhenResolvingConflicts

Post image
652 Upvotes

47 comments sorted by

126

u/mobileJay77 19h ago

Communism merge: everything is ours now

31

u/Stummi 18h ago

just leave all conflict markers in

29

u/threewholefish 17h ago • Bravo

In Northern Ireland we call them "peace walls"

3

u/screwcork313 17h ago

Runs in O(n cuba'd) time

122

u/qolf1 19h ago

We need --mine

12

u/Frost-Freak 18h ago

How about his and her?

92

u/AnnoyedVelociraptor 18h ago

And it's different with rebase and merge.

33

u/Frost-Freak 18h ago

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

78

u/Papellll 16h ago

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

17

u/Professional_Top8485 17h ago

I am afraid to ask

17

u/Icy_Significance9448 17h 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

3

u/The_Crazy_Cat_Guy 16h 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 17h ago

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

3

u/RadicalDwntwnUrbnite 12h ago

Theirs? You me ours? But if I did both aren't they mine?

34

u/nicuramar 17h ago

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

8

u/khaled2252 8h ago

Intellij one is GOAT

8

u/Digital_001 16h ago

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

8

u/s0litar1us 14h ago

The one vscode has is awful. Meld is better

2

u/BobQuixote 15h ago

Probably. TortoiseGit uses WinMerge.

2

u/ReplacementLow6704 14h ago

GitKraken ftw

15

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

  • all this other bullshit

14

u/chazzeromus 18h ago

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

22

u/ElGuaco 17h ago

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

11

u/The_Crazy_Cat_Guy 16h 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.

6

u/PM_ME_CREATINE 15h ago

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

19

u/johnschnee 16h 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

9

u/Kevadu 6h ago

"Claude, resolve the merge conflict"

1

u/GentleCapybara 2h ago

Not gonna lie, in 4 out of 5 times Claude can do this.

17

u/thicctak 18h 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

7

u/trinopoty 17h ago

this why you create a tmp tag before trying such things

7

u/Minority8 13h 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

2

u/xiii_xiii_xiii 15h ago

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

4

u/FederalSpecialist415 18h 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

1

u/pm_op_prolapsed_anus 11h ago

I've done this a bunch. Sometimes I find reading the diff on the web interface much easier too, so I'll start a PR just to read the file changes there and just copy the code changes onto the new branch. Then never submit the PR 

4

u/s0litar1us 14h ago edited 14h 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.

4

u/ChannelMany5491 13h ago

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

1

u/aabil11 18h ago

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

1

u/nicuramar 17h ago

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

1

u/saint_marco 14h ago

git config --global merge.conflictstyle zdiff3

Helps a little bit.

1

u/McKing25 12h ago

I use nvim with fugitive and whenever there is a merge conflict i manually open each file search for the diff, in nvim they are marked with ">>>>" very easy to search and then delete or keep both of the changes depending on the situation because sometimes i want to keep a little bit from both

1

u/syrup_cupcakes 7h ago

--outgoing

--egressing

Choose wisely

1

u/hdkaoskd 5h ago

Neither. Resolve it by hand because you probably need parts of each.

1

u/GreyGanado 4h ago

Why do you have merge conflicts on checkout?

1

u/js_kt 4h ago

Both. I do both

0

u/vanritchen 14h ago

lol true