r/ProgrammerHumor • • 14d ago

Meme iNeverKnowWhichIsWhichWhenResolvingConflicts

Post image
958 Upvotes

67 comments sorted by

202

u/mobileJay77 14d ago

Communism merge: everything is ours now

46

u/Stummi 14d ago

just leave all conflict markers in

40

u/threewholefish 14d ago • Bravo

In Northern Ireland we call them "peace walls"

5

u/screwcork313 14d ago

Runs in O(n cuba'd) time

2

u/c-lee_360288 7d ago

The merge is collective ownership; git blame is where the commune falls apart.

178

u/qolf1 14d ago

We need --mine

20

u/Frost-Freak 14d ago

How about his and her?

5

u/BenTheHokie 13d ago

they/them/theirs

63

u/nicuramar 14d ago

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

12

u/khaled2252 13d ago

Intellij one is GOAT

15

u/Digital_001 14d ago

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

17

u/s0litar1us 14d ago

The one vscode has is awful. Meld is better

4

u/BobQuixote 14d ago

Probably. TortoiseGit uses WinMerge.

2

u/ReplacementLow6704 14d ago

GitKraken ftw

1

u/glorious_reptile 13d ago

That’s what i keep telling my wife!

-1

u/slaymaker1907 12d ago

If it's anything that is non-trivial to resolve in VS Code then I have Claude fix the merge conflicts.

24

u/jikt 14d ago
  • the shit I was working on
  • all this other bullshit

20

u/chazzeromus 14d ago

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

17

u/The_Crazy_Cat_Guy 14d 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.

11

u/PM_ME_CREATINE 14d ago

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

27

u/ElGuaco 14d ago

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

24

u/johnschnee 14d 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

1

u/rosuav 11d ago

Git-loving senior dev with 20 years of experience here: I have basically never used --ours or --theirs. It's much easier to do a regular merge, then edit files for any conflicts, add them, move on. It's symmetric.

21

u/thicctak 14d 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

8

u/trinopoty 14d ago

this why you create a tmp tag before trying such things

11

u/Minority8 14d 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 14d ago

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

10

u/CraftBox 13d ago

A good rule of thumb:

Success -> ours

Failure -> theirs

3

u/4x-gkg 11d ago

"There is no 'I' in 'TEAM', But there is 'U' in 'BUG'"

11

u/Kevadu 13d ago

"Claude, resolve the merge conflict"

1

u/GentleCapybara 13d ago

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

1

u/AMillionTimesISaid 12d ago

Better than 80% no?

5

u/FederalSpecialist415 14d 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/pm_op_prolapsed_anus 14d 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 

5

u/ChannelMany5491 14d ago

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

4

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

3

u/cookiedanslesac 12d ago

I am confused, everybody seems to have "ours" and "theirs", while I have only experienced "local" and "remote" (which is less confusing when merging vs rebasing).

1

u/LutimoDancer3459 12d ago

There is no remote when you do it on your local machine. And rebasing means you are on the main branch and rebase the other on this one. So the other branch is the one your work was done. While merging, you are still in the branch you did your work if you wnat the main branch changes. But is flipped again when you want your changes in the main branch. It doesnt matter if its our/theirs or remote/local. Both are confusing

-2

u/cookiedanslesac 12d ago

I was speaking of "git mergetool", hence local/remote. Are others speaking of git cli or some ide with obscur naming ?

1

u/LutimoDancer3459 12d ago

I mostly use intellij and there its called yours and theirs i think?... actually didnt pay attention to it for a long time because I look at the changes themselves...

But I didnt meant that a "remote" doesnt exist from a naming point. It just doesn't make sense when you do merges locally because you merge the branches that are on your local machine. Naming it local/remote does makes as much or as little sense as (y)ours/theirs.

2

u/saint_marco 14d ago

git config --global merge.conflictstyle zdiff3

Helps a little bit.

2

u/hdkaoskd 13d ago

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

1

u/aabil11 14d ago

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

1

u/nicuramar 14d ago

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

1

u/McKing25 14d 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 13d ago

--outgoing

--egressing

Choose wisely

1

u/GreyGanado 13d ago

Why do you have merge conflicts on checkout?

1

u/js_kt 13d ago

Both. I do both

1

u/FerricPowder 13d ago

Thats why i use vs code for merge conflicts.

1

u/Troncross 12d ago

There’s is target, ours is source

If you resolve locally with a text editor instead of a UI, you could keep a little of both

1

u/SAI_Peregrinus 11d ago

jj is more sensible. You can have any number of parent revisions for a merge, just like git "octopus" merges, so it just lists the parent revisions change IDs and subject.

1

u/Mountain-Ox 9d ago

This is why I just manually fix them, or I used to. Now Claude fixes it and I just review it.

1

u/semrola 7d ago

claude do the merge and solve conflicts

1

u/StrawberryEiri 13d ago

Ew, command line Git

0

u/vanritchen 14d ago

lol true

0

u/[deleted] 14d ago

[deleted] — view deleted comment

43

u/Frost-Freak 14d ago

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

132

u/Papellll 14d ago

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

19

u/Professional_Top8485 14d ago

I am afraid to ask

25

u/Icy_Significance9448 14d 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

4

u/The_Crazy_Cat_Guy 14d 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 ?

2

u/heaverdini 13d ago

Not sure if this helps but “rebased dev on my branch” might be the wrong way to conceptualize this. You’re re-basing in the sense that dev will be the new “base” for your feature branch. You’re going to replay the commits, so it’s typically easier to squash your commits into just one with an interactive rebase or something. That way if there are conflicts you only have to resolve them one time :)

There shouldn’t be anything in the diff from the branch you’re merging into if you’ve rebased correctly, probably picked the wrong conflict resolutions 😢

2

u/LutimoDancer3459 12d ago

Merge depends on the direction. Feature into main or main into feature.

1

u/nicuramar 14d ago

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

6

u/RadicalDwntwnUrbnite 14d ago

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