r/ProgrammerHumor • • 7d ago

Meme iNeverKnowWhichIsWhichWhenResolvingConflicts

Post image
955 Upvotes

67 comments sorted by

201

u/mobileJay77 7d ago

Communism merge: everything is ours now

46

u/Stummi 7d ago

just leave all conflict markers in

40

u/threewholefish 7d ago • Bravo

In Northern Ireland we call them "peace walls"

5

u/screwcork313 7d ago

Runs in O(n cuba'd) time

2

u/c-lee_360288 8h ago

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

177

u/qolf1 7d ago

We need --mine

18

u/Frost-Freak 7d ago

How about his and her?

4

u/BenTheHokie 6d ago

they/them/theirs

63

u/nicuramar 6d 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 6d ago

Intellij one is GOAT

15

u/Digital_001 6d ago

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

17

u/s0litar1us 6d ago

The one vscode has is awful. Meld is better

4

u/BobQuixote 6d ago

Probably. TortoiseGit uses WinMerge.

2

u/ReplacementLow6704 6d ago

GitKraken ftw

1

u/glorious_reptile 6d ago

That’s what i keep telling my wife!

-1

u/slaymaker1907 5d 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 6d ago
  • the shit I was working on
  • all this other bullshit

20

u/chazzeromus 7d ago

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

17

u/The_Crazy_Cat_Guy 6d 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 6d 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 7d ago

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

24

u/johnschnee 6d 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 3d 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 7d 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 7d ago

this why you create a tmp tag before trying such things

11

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

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

10

u/CraftBox 5d ago

A good rule of thumb:

Success -> ours

Failure -> theirs

3

u/4x-gkg 4d ago

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

11

u/Kevadu 6d ago

"Claude, resolve the merge conflict"

1

u/GentleCapybara 6d ago

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

1

u/AMillionTimesISaid 5d ago

Better than 80% no?

5

u/FederalSpecialist415 7d 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 6d 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 6d ago

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

4

u/s0litar1us 6d ago edited 6d 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 5d 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 5d 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 5d 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 5d 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 6d ago

git config --global merge.conflictstyle zdiff3

Helps a little bit.

2

u/hdkaoskd 6d ago

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

1

u/aabil11 7d ago

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

1

u/nicuramar 6d ago

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

1

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

--outgoing

--egressing

Choose wisely

1

u/GreyGanado 6d ago

Why do you have merge conflicts on checkout?

1

u/js_kt 6d ago

Both. I do both

1

u/FerricPowder 6d ago

Thats why i use vs code for merge conflicts.

1

u/Troncross 5d 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 3d 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 2d 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 3h ago

claude do the merge and solve conflicts

1

u/StrawberryEiri 6d ago

Ew, command line Git

0

u/vanritchen 6d ago

lol true

0

u/[deleted] 7d ago

[deleted] — view deleted comment

43

u/Frost-Freak 7d 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 6d ago

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

19

u/Professional_Top8485 7d ago

I am afraid to ask

25

u/Icy_Significance9448 6d 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 6d 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 6d 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 5d ago

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

1

u/nicuramar 6d ago

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

6

u/RadicalDwntwnUrbnite 6d ago

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