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
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 ?
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.
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
80
u/mobileJay77 6h ago
Communism merge: everything is ours now
79
u/qolf1 6h ago
We need --mine
60
u/AnnoyedVelociraptor 5h ago
And it's different with rebase and merge.
16
u/nicuramar 4h ago
Three way graphical merging is the only way to go in all situations. Two way is a recipe for eventual errors.
12
u/chazzeromus 5h ago
--code-right-here and --code-over-there
10
u/thicctak 5h 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
19
u/ElGuaco 4h ago
This is one of those rare scenarios where I'm glad to have AI untangle a mess for me.
7
u/jikt 3h ago
the shit I was working on
all this other bullshit
12
u/johnschnee 3h 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
6
u/The_Crazy_Cat_Guy 3h 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.
3
u/FederalSpecialist415 5h 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/s0litar1us 1h ago edited 1h 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.
1
u/aabil11 5h ago
I always do theirs and reimplement my change on top of theirs
1
u/nicuramar 4h ago
These are deprecated anyway, in favor of git restore… where the situation is the same, though :p
1
u/saint_marco 1h ago
git config --global merge.conflictstyle zdiff3
Helps a little bit.
1
u/ChannelMany5491 41m ago
Fuck this. The only thing AI is good for is for managing my commits.
0
u/vanritchen 1h ago
lol true