Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can git format patch so it can be used with patch program?

Tags:

git

patch

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?

like image 651
Nikola Kotur Avatar asked Oct 20 '09 13:10

Nikola Kotur


People also ask

What does git format patch do?

If given --thread , git-format-patch will generate In-Reply-To and References headers to make the second and subsequent patch mails appear as replies to the first mail; this also generates a Message-Id header to reference.

When should I format a git patch?

Git patch files are very beneficial : they are used in order to store differences that need to be applied to a file or a group of files on your system. Git patch is historically linked to the Unix “patch” command that was used in early Unix versions to store differences between files or binaries.


1 Answers

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.

like image 189
P Shved Avatar answered Sep 21 '22 10:09

P Shved