Git Patch and Email Workflows

Patch-oriented Git workflows using format-patch, apply, am, and range-diff for mailing-list and review-based collaboration.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Create Patch Series

Generate mail-ready patches from commits and ranges.

Format last commit

Generate one patch file from latest commit.

bashANYpatchemail
bash
git format-patch -1 HEAD

Format commit range

Generate patches for commits not yet upstream.

bashANYpatchemail
bash
git format-patch origin/main..HEAD

Format with cover letter

Generate last 3 commits plus cover letter template.

bashANYpatchemailcover-letter
bash
git format-patch --cover-letter -3

Format threaded series

Prepare patches for email threading.

bashANYpatchemailthread
bash
git format-patch --thread -5

Apply Patches and Mailboxes

Apply single patches or email mailboxes to a branch.

Check patch applicability

Validate patch without modifying files.

bashANYpatchapply
bash
git apply --check feature.patch

Apply patch and update index

Apply patch to working tree and index.

bashANYpatchapply
bash
git apply --index feature.patch

Apply mailbox series

Apply email-formatted patches as commits.

bashANYpatcham
bash
git am 0001-feature.patch

Continue git am

Resume after conflict resolution.

bashANYpatchamconflict
bash
git am --continue

Abort git am

Cancel mailbox application and restore state.

bashANYpatchamundo
bash
git am --abort

Review and Compare Series

Review patchsets across versions and compare series revisions.

Range-diff two series

Review changes between patch series revisions.

bashANYpatchrange-diff
bash
git range-diff origin/main...v1 origin/main...v2

Log with patches

Review commits as patch text.

bashANYpatchreview
bash
git log -p origin/main..HEAD

Show one commit patch

Inspect a single commit as patch text.

bashANYpatchreview
bash
git show --patch <commit_sha>