Skip to main content
QUIETLYTIC
Developer

Git Patch Parser

Parse git format-patch output into author, subject and diff.

Local · nothing leaves this browser Waiting for a patch
Esc Clear
Parsed

Paste a patch on the left.

How it works

`git format-patch` output is an mbox-style email — a `From` line with a commit SHA and a date, then From:/Date:/Subject: headers, then the commit message body, then a --- separator and diffstat, then the actual diff. This reads the header block and commit message separately from the diff itself, so you get the author, subject and change in one structured view instead of reading the raw text top to bottom.

The diff section reuses this site's Git Diff Viewer parser

Once the header block ends, everything from the first diff --git line onward is exactly the unified diff format `git diff` produces — the same parser that tool uses reads it here, so a patch with multiple files renders as one section per file with full hunk detail.

The `[PATCH n/m]` prefix is stripped from the subject

A patch series numbers each message — [PATCH 2/5] Add validation — and that prefix is not part of the actual commit subject; it is removed here so what's shown is the message a `git log` would print, not the mailer's own series bookkeeping.

Example

A single-commit patch parses to one author, one subject, and a diff for as many files as the commit touched — the same information `git am` would apply, read without applying anything.

Frequently asked questions

What is the "---" line for?

It separates the commit message from the diffstat summary and the actual diff, in git format-patch's own layout. Everything before it — From, Date, Subject and the body — is the commit message; everything from the first diff --git line onward is the change itself.

Why is [PATCH 2/5] stripped from the subject?

Because it's a patch series' own numbering, added by the mailer, not part of the commit message git log would show. Stripping it means the subject reported here matches what git am would actually record as the commit subject.

Related tools

From the intelligence desk