I have a reason¹ to create my git commits as patch files using git-format-patch with the --no-prefix
option.
This option changes the patch output to not add the git-diff-specific prefixes a/
/ b/
in file paths in the patch files. It allows tools like patch
to apply the patch files without the need to pass -p1
as argument.
All cool so far. However, it seems that I cannot actually apply them anymore with Git itself (git-am):
$ git am path/to/0001-patch.patch
Applying: <commit message subject>
error: <path>: does not exist in index
Patch failed at 0001
[...]
How do I apply them with git-am
now, while maintaining plain patch
compatibility?
¹ It allows me to use it as patch files in Bazel without custom patch commands, as you'd need to apply patches with patch -p1 [...]
.