+3 votes
1 view
in Devops and Agile by (20k 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 (28.4k 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 (28.1k points)
Easy steps. This was helpful.
Welcome to Intellipaat Community. Get your technical queries answered by top developers !