Conventional patch
git format-patch OlderSHA..NewerSHA
normally creates one patch file per commit between OlderSHA
and NewerSHA
, exclusive of OlderSHA
(it's the base for the changes) and inclusive of NewerSHA
.
For instance, in this "real world" example, there are five commits between SHAs and so git format-patch
makes five patch files.
git format-patch 3caf9c2..0aa9968
0001-About-as-far-as-you-get-adding-new-module-to-RCP-wit.patch
0002-Add-a-trivial-service.patch
0003-Rename-files-and-add-lazy-module-class.patch
0004-Add-WCS-shim-and-add-to-testRouteMap.patch
0005-Add-module-to-routing-to-enable-lazy-loading.patch
Problem statement
I would like to produce a single file representing all of the changes between OlderSHA
and NewerSHA
that could be applied in a single command. I'm not looking to preserve state between the two SHAs; I only want the final differences stored in the patch file.
git format-patch --single-file-option? 3caf9c2..0aa9968
EVERYTHING_BETWEEN_SHAs.patch
I've looked over the docs on format-patch
a bit and if this is an option, I've missed it.
The problem is a little hard to google, as "single file", even "output single patch file" seem to converge on "I want patches that related to a single file" results instead.
Note that I also don't simply want to concatenate five files into one; I want the difference between the two commits in a single file with a single entry or section in the resulting file for each file's changes. (If foo
changes to bar
in commit 2 and back to foo
in commit 5, I don't want it to appear in SuperPatch.patch)
Does this option exist?