I have a patch that gives out the following output when I try to apply it with git am
Checking patch old/filename... error: old/filename: does not exist in index
Within the patch old/filename is actually moved to new/filename but it seems the original file is already missing from the source tree.
So what is the error about and how to solve / work-around it? Can it just be ignored (with --reject or so)?
The patch was not created against the correct source tree.
One way this could happen:
Assume your original branch (the one you want to apply the patch to) has commits:
This branch is then cloned, and new commits are made:
Commit 1e included old/filename
Now you do the work in the patch, based on the second branch, not the original one:
Commit 1f included the rename old/filename -> new/filename
Now, if you create a patch for commit 1f, you won't be able to apply it on top of commit 1d, because commit 1e is missing where old/filename was added to the index/repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With