Junio C Hamano <gitster@xxxxxxxxx> writes: > ... then we may have had split (3) into three pieces: > > (3a) material before the pure diff (e.g. diffstat, etc.) > (3b) pure diff > (3c) trailing junk (e.g. base-commit info, e-mail signature, etc.) > ... > So, because there is no such need so far, there is no tool in the > Git toolbox to split (3) into three pieces. > > You're welcome to write one, but the current toolset does not need > it. Writing something that reads (3), discarding lines before the first "diff --git", counting lines that appear on "@@ ... @@" line while copying it to the output, repeating the process when you see something other than "diff --git" (i.e. beginning of the patch for the next path) or "@@ ... @@" (i.e. another hunk in the patch for the current path), and discarding the rest may be trivial. But in practice, people edit their diff [*1*], forgetting the line counts on the "@@ ... @@" lines, and it helps the maintainer to have the whole (3), not only (3b), in a single file to recover from such a broken patch submission. So adding another tool to produce (3b) only is fine, but an attempt to get rid of (3) and to claim that (3b) replaces the need for (3) is highly discouraged. Thanks. [Footnote] *1* Even when people edit without changing the line numbers (imagine a typofix on a '+' line), I saw that "patch" mode of Emacs broke the line count on "@@ ...@@" line of the last hunk when the patch ends with certain patterns.