Jay Taylor's notes
back to listing indexGenerate a git patch for a specific commit
[web search]
I need to write a script that create patches for a list of SHA1 commit numbers. I tried using Is there a way to generate a patch only for the specific SHA1?
|
||||
Try:
|
|||||||||||||||||||||||||||||||||
|
For generating the patches from the topmost commits from a specific sha1 hash:
The last 10 patches from head in a single patch file:
|
|||
Say you have commit id 2 after commit 1 you would be able to run:
where 2 and 1 are SHA hashes.
|
|||||||||||||||||||||
|
This command (as suggested already by @Naftuli Tzvi Kay):
Replace will generate the patch file for the latest commit formatted to resemble UNIX mailbox format.
Then you can re-apply the patch file in a mailbox format by:
See:
|
||||
If you want to be sure the (single commit) patch will be applied on top of a specific commit, you can use the new git 2.9 (June 2016) option
See commit bb52995, commit 3de6651, commit fa2ab86, commit ded2c09 (26 Apr 2016) by Xiaolong Ye (``).
|
|||
Your Answer
asked |
5 years ago |
viewed |
245092 times |
active |
Technology | Life / Arts | Culture / Recreation | Science | Other | ||||||
---|---|---|---|---|---|---|---|---|---|---|