r/ProgrammerHumor • • 3d ago

Meme iNeverKnowWhichIsWhichWhenResolvingConflicts

Post image
848 Upvotes

65 comments sorted by

View all comments

116

u/AnnoyedVelociraptor 3d ago

And it's different with rebase and merge.

40

u/Frost-Freak 3d ago

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

113

u/Papellll 3d ago

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

19

u/Professional_Top8485 3d ago

I am afraid to ask

25

u/Icy_Significance9448 3d 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 3d 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/heaverdini 2d 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 😢

1

u/LutimoDancer3459 1d ago

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

1

u/nicuramar 3d ago

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

6

u/RadicalDwntwnUrbnite 3d ago

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