• Extract commits between revisions R1 and R2, and apply them
on top of the current branch using git am to cherry-pick
them:
$ git format-patch -k --stdout R1..R2 | git am -3 -k
• Extract all commits which are in the current branch but not
in the origin branch:
$ git format-patch origin
For each commit a separate file is created in the current
directory.
• Extract all commits that lead to origin since the inception
of the project:
$ git format-patch --root origin
• The same as the previous one:
$ git format-patch -M -B origin
Additionally, it detects and handles renames and complete
rewrites intelligently to produce a renaming patch. A
renaming patch reduces the amount of text output, and
generally makes it easier to review. Note that non-Git
"patch" programs won't understand renaming patches, so use it
only when you know the recipient uses Git to apply your
patch.
• Extract three topmost commits from the current branch and
format them as e-mailable patches:
$ git format-patch -3