I have a patch file which contains a single line change. Running git am
fails with the message:
error: patch failed: Pages/Index.cshtml.cs:15
error: Pages/Index.cshtml.cs: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: restrict index page to internal users
Patch failed at 0001 restrict index page to internal users
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
The target file does have a couple of extra lines above the changed line. Is this failing because git cannot determine where the single line change? If so, does this mean that the target file and source file need to be essentially the same?
Running git apply
with the same patch produced this message:
error: patch failed: Pages/Index.cshtml.cs:15
error: Pages/Index.cshtml.cs: patch does not apply
I believe this is basically the same message, just friendly (or, at least, less verbose.)
Am I attempting something which patches are not meant for? Namely, applying a change from one repository to another which are not possessing file content equivalence.
I did find this post but when using the same solution all I get is no change and a simple .rej
file output.