git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[FEATURE] Proposal: git format-patch with `--with-line-numbers` flag

From
Seyi Kuforiji <kuforiji98@gmail.com>
Date
Aug 18, 2025, 10:08 UTC
Message-ID
<CAGedMtd_atWTAQXOPSJThB_tpHiOSY=PUhrfFxFZOEkgUtHf1w@mail.gmail.com>
Hi Everyone,

While working on converting unit tests and sending patches, I ran into a pain point during review. The reviews by Junio, Patrick, and others pointed out issues in my patches, but without line numbers in the emailed code context, it was sometimes hard to know exactly which line was being referenced. I had to manually count through the diff hunks, which slowed things down.

To address this, I’d like to propose adding an option to `git format-patch` (e.g., `--with-line-numbers`) that would include line numbers numbers alongside context lines in the generated patch. This would not affect patch application (`git am` / `git apply`), but would be a visual aid for mailing list readers.

Benefits:
- Makes reviews on the mailing list clearer and faster.
- Let reviewers point out "line 52 has an off-by-one" for easy review.
- Reduces friction for new contributors.
Possible concerns:
- Could clutter diffs if not formatted cleanly.

I wanted to ask for feedback: would this kind of feature be welcomed? If so, I’d be happy to draft a patch implementing it.

Best regards, Seyi Kuforiji

Next: Junio C Hamano
Message 1 of 4 in “[FEATURE] Proposal: git format-patch with `--with-line-numbers` flag”
  1. Seyi KuforijiAug 18, 2025
  2. Junio C HamanoAug 18, 2025
  3. Seyi KuforijiAug 21, 2025
  4. Junio C HamanoAug 21, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.