I would like to create a patch for the last 2 revisions.
git format-patch -2
gives me 2 patch files, one for each revision
git format-patch HEAD~2..HEAD
gives the same thing.
git format-patch -1 HEAD~2..HEAD
gives a single file, but only contains changes for the last revision.
Is there any way to do this in git?
git diff HEAD~2..HEAD > my-patch.diff
It won't have any of format-patch's per-commit metadata, though.
Use the --stdout option and then cat it to a file.
Like so:
git format-patch HEAD~2..HEAD --stdout > changes.patch
This will keep the per-commit metadata.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With