How to get “their” changes in the middle of conflicting Git rebase?

You want to use:

git checkout --ours foo/bar.java
git add foo/bar.java

If you rebase a branch feature_x against main (i.e. running git rebase main while on branch feature_x), during rebasing ours refers to main and theirs to feature_x.

As pointed out in the git-rebase docs:

Note that a rebase merge works by replaying each commit from the
working branch on top of the branch. Because of this, when
a merge conflict happens, the side reported as ours is the so-far
rebased series, starting with <upstream>, and theirs is the working
branch. In other words, the sides are swapped.

For further details read this thread.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)