Explore Courses Blog Tutorials Interview Questions
+3 votes
in DevOps and Agile by (19.4k 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 (27.5k 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 (29.3k points)
Easy steps. This was helpful.

Browse Categories