tags:

views:

167

answers:

1

I'd need to create simple patches from git repository that can be applied with plain simple patch command line utility.

Can it be done?

+6  A: 

Patches, that git diff yields, are correctly processed by patch tool.

patch skips all the additional info git appends to the patch file. To apply the patch you most likely will need -p1 option.

Pavel Shved
Thanks. Will try it out, I guess I need more coffee...
Nikola Kotur
Patches generated by `git format-patch` are also correctly procesed by GNU patch... unless they are generated with -M / -C option and contain information about renames, etc.
Jakub Narębski
From the `patch` man page: "patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage." The big unique thing in git diffs is the addition of modelines (e.g. "index...", "rename...", "new file...") and patch is able to simply skip these. Git also prefixes filenames, e.g. "a/path/to/file", but this can be skipped by patch's -p1.
Jefromi