gitpatch

In git, how do I create a single patch for the last 2+ revisions?


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?


Solution

  • git diff HEAD~2..HEAD > my-patch.diff
    

    It won't have any of format-patch's per-commit metadata, though.