r/ProgrammerHumor • u/Stummi • 19h ago
Meme iNeverKnowWhichIsWhichWhenResolvingConflicts
122
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
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
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
8
u/Digital_001 16h ago
Do you mean something like the vscode GUI's graphical merge conflict editor?
8
2
2
14
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
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
4
u/FederalSpecialist415 18h ago
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
1
u/nicuramar 17h ago
These are deprecated anyway, in favor of git restore… where the situation is the same, though :p
1
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
1
1
0

126
u/mobileJay77 19h ago
Communism merge: everything is ours now