Apply patches created with git log -p

You need to break the patches down into individual patches. You could do that manually from your git log -p output, then use git apply to apply them in sequence. git log -p output wasn't really intended for git to process...

But a better option would be to use git format-patch to create the sequence of patch files for you (no manual splitting needed), then use git am to apply them all in one go...

git format-patch -o <output_directory> <from_revision>..<to_revision> -- file-of-interest.txt

Also note that git am expects email-formatted patches (like those produced by git format-patch, which is why you get "Patch format detection failed"). Patches generated with diff or git diff should be applied with git apply, not git am. But the git format-patch / git am workflow is more flexible and generally more robust.

Tags:

Git

Patch