From master
, the A
branch was branched. Then, a few commits (to master
) later, B
branch was branched.
The owner of A
made changes to file fname
. The owner of B
removed fname
altogether.
Then, B
was rebased and merged into master
. Now, A
is to be rebased and merged. But now A
's owner gets a conflict with file fname
, saying that:
CONFLICT (modify/delete): fname deleted in HEAD and modified in "commit msg". Version "commit msg" of fname left in tree.
Normally, conflicts are resolved by editing the intermediate file, git add fname
it and then git rebase --continue
the process.
But how to resolve a conflict of a removed file? The end result should be that the files is removed.
In this case you can just delete the file not with git rm
but just with rm
.
rm fname
git add fname
#Fix any other conflict
git rebase --continue
Whichever way you leave your file it will be used in the new commit that is being generated.
What's going on:
master
.git rm
because that file is not under version control.If the only change in the current commit was on this deleted file you'll get this error:
`No changes - did you forget to use 'git add'?`
This is because there is nothing to commit (You have just deleted a file that did not exist in git) In that case you can git rebase --skip
instead of --continue
.