Re: [FEATURE] Proposal: git format-patch with `--with-line-numbers` flag
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 21, 2025, 19:50 UTC
- Message-ID
- <xmqqa53s1mk5.fsf@gitster.g>
- In-Reply-To
- <CAGedMtf2CW_L8uSc1KRqmAoJ=2Sw4t5AL2AC0uKQJb5keX63ZA@mail.gmail.com>
Seyi Kuforiji <kuforiji98@gmail.com> writes:
Show 18 quoted lines
>> One things I try in my reviews is, even though I trim my quotes >> heavily and leave only the part I comment on, I try to leave the >> filename part (i.e. "diff --git" line) and the hunk header (i.e. "@@ >> -L,K +M,N @@" line) in. See >> >> https://lore.kernel.org/git/xmqqikla86id.fsf@gitster.g/ >> >> for an example. >> > Ah, thanks for the clarification; that makes sense now. Up until this > point, I didn't know the hunk headers "(@@ -L,K +M,N @@ lines)" > provided enough context in terms of the lines the changes were made. I > just never read them and usually just jump to the reviews on the code > changes, and I try to locate the changes locally :(. I agree this > already provides sufficient context, and I've definitely learned > something new here :). I am wondering if a description of this is > covered in our documentation. If not, maybe I could add it, since I > imagine others might have the same question.
I do not think our documentation (documentation proper, not handholding newbies tutorials) wants to repeat what is in
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/diff.html#tag_20_34_10_07
and explain what different parts of a "patch" output look like, but perhaps MyFirstContribution would be a good place to add it, if not done already.
Thanks.