So, you are doing your own little thing, developing on a feature branch and whatnot, and you delete a file as part of this work. When the time finally comes to merge/rebase it on the upstream branch, you end up with a git status --short looking like this:
... DU src/myfile.js ...
D in the first column means you deleted the file, U in the second column means the other branch made modifications to it. You have to make sure that those modifications are not lost, eg. if you regrouped some logic from this deleted file, to another file, you have to make sure you also move the logic added by upstream to the other file. What you need is a diff, between the base file, and the upstream modified one, and try as hard as you might, you won't find this (or it's just my git-fu is lacking):
git diff src/myfile.js * Unmerged path src/myfile.js git checkout -m src/myfile.js error: path 'src/myfile.js' does not have all necessary versions
I was looking for something like git checkout --base, but that does not exist. Turns out git commands accept some kind of colon notation, that let's you refer to a file as it looked in the 1: base form, 2: your (our) form, 3: other (their) form. The correct solution to generating this diff is then:
git diff :1:src/myfile.js..:3:src/myfile.js
No, I did not make this up. If anyone has a better solution please share it.