11

Following on the scenario from this question, I'm performing a git rebase -s recursive -X theirs etc... and am surprised to be stopped with the following types of conflicts:

  • added by them
  • deleted by them
  • deleted by us

Is there some reason the strategy doesn't cope with these?

(I don't know if this is significant, but git doesn't report conflicts in the output, it just says When you have resolved this problem run "git rebase --continue")

UPDATE Here's a script that doesn't quite reproduce, but nearly:

git init
git symbolic-ref HEAD refs/heads/Branch1  #just to get the 'right' branch name
echo Added in A > DeletedByThem.txt
git add -A
git commit -m A

echo Modified in B >> DeletedByThem.txt
git add -A
git commit -m B

echo Modified in C >> DeletedByThem.txt
echo Added in C > DeletedByUs.txt
git add -A
git commit -m C

git checkout -b Branch2
echo Modified in D >> DeletedByUs.txt
git rm DeletedByThem.txt
git add -A
git commit -m D

echo Modified in E >> DeletedByUs.txt
git add -A
git commit -m E

At this point, you should have this:

Branch1:    A - B - C
                     \
Branch2:              D - E

What we want is this:

Branch1:    A - B - C
                 \
Branch2:          D - E

So:

git rebase -s recursive -X theirs --onto [SHA of B] Branch1 Branch2

This reproduces the 'deleted by them' and 'deleted by us' problems, but doesn't reproduce the 'added by them', nor the absence of any conflict report.

From what I can gather, in this context 'deleted by them' thus means "modified after B, then deleted" (so we do want to delete it in Branch2), and "deleted by us" means "created after B" (so we want to keep it in Branch2)

From what I can tell from the history of my real (and enormous) repo, the 'added by them' is related to incorrectly detected renames (i.e. identical files in completely different folders being identified as renames).

Community
  • 1
  • 1
Benjol
  • 63,995
  • 54
  • 186
  • 268
  • Are you simply inferring that these are the conflicts, or does it report them while trying to apply patches, then correctly resolve them and therefore not report them in the output of `git status`? – Cascabel Feb 08 '11 at 20:22
  • 1
    I guess I'm inferring, given that the rebase stops. – Benjol Feb 08 '11 at 22:35
  • 1
    @Jefromi, sorry, I forgot to @ my last comment. Currently trying to script something to reproduce this... – Benjol Feb 09 '11 at 06:14

1 Answers1

2

The reason that you get a conflict is because rebase is trying to apply a patch that is impossible to apply.

The file that the patch instructs us to delete, it can't find.

This behavior is by design.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • 1
    I am getting the same conflict prompt (deleted by them) but a file exists, so I'm not sure if that's always the case. – pilau Aug 02 '13 at 10:47