Cyan Cyan - 2 months ago 9
Git Question

how to extract commit patches from a git repository

I would like to extract all patches from a git repository,
or at least all ancestors from a selected tag or commit.

I need each commit as a separate patch. Each patch should end up into its own file. The command can create a directory or a tar archive.

Closest I could find is

git-format-patch
, but it outputs everything as a single patch.

qzb qzb
Answer

You can achieve that with git-format-patch:

git format-patch -o patches --root HEAD

It will write patches to patches directory. Of course you can replace HEAD with sha of particular commit or with some tag.

Comments