+3 votes
1 view
in Devops and Agile by (15.5k points)
edited by

I need to write a script that creates patches for a list of SHA1 commit numbers.

I tried using git format-patch <the SHA1>, but that generated a patch for each commit since that SHA1. After a few hundred patches were generated, I had to kill the process.

Is there a way to generate a patch only for the specific SHA1?

1 Answer

+3 votes
by (20.6k points)

Here's what you can do:

git format-patch commit_Id~1..commit_Id  

git apply --check patch-file-name

git apply patch-file-name

by (21.4k points)
Easy steps. This was helpful.
...