Rust CLI for GitHub PR patch streams

Split a Pull Request into commit-sized patch files.

Patchsplit downloads a GitHub Pull Request .patch file and writes one portable patch file per commit, ready for review, archiving, replay, or handoff.

$ patchsplit openai codex 42 -o pr-42-patches
downloaded https://github.com/openai/codex/pull/42.patch
wrote 2 patch file(s)
pr-42-patches/0001-add-parser.patch
pr-42-patches/0002-wire-cli.patch
1 PRinput
N patchesoutput
curlruntime dependency

Patchsplit

Built for patch-level review work

The tool keeps the workflow explicit: fetch the pull request patch, split by commit boundaries, and write predictable files without surprise overwrites.

01

Two input styles

Use owner/repo with a PR number, or pass owner, repo, and PR number as separate arguments.

02

Predictable filenames

Each file starts with a four-digit index and a sanitized commit subject, such as 0001-add-parser.patch.

03

No accidental overwrite

Existing output files are protected by default. Add --force only when replacing them is intentional.

04

Lean Rust binary

The current implementation uses no third-party Rust crates and calls the system curl command for HTTPS downloads.

Flow

From PR to patch set

01

Point at a Pull Request

Patchsplit builds the GitHub .patch URL from the repository and PR number.

02

Download the patch stream

curl follows redirects, fails on HTTP errors, and identifies itself with the patchsplit version.

03

Split by commit

Mail-style From markers define commit boundaries. A raw single patch is kept as one file.

04

Write portable files

Output lands in patches/ by default, or in the directory supplied with --out.

CLI

Usage

Run either command shape, then pick the output directory behavior you need.

Repository shorthand

patchsplit <owner/repo> <pr-number> [--out <dir>] [--force]
patchsplit rust-lang/rust 12345

Separate owner and repo

patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force]
patchsplit openai codex 42 -o pr-42-patches

Options

-o, --out <dir>
Output directory for split patch files. Defaults to patches/.
-f, --force
Overwrite existing patch files.
-h, --help
Show help.
-V, --version
Show version.

Packages

Install from release packages

Release archives are produced for Linux, macOS, and Windows from v* tags.

Linux

tar -xzf patchsplit-linux-x86_64.tar.gz
chmod +x patchsplit
sudo install -m 755 patchsplit /usr/local/bin/patchsplit
patchsplit --version

macOS

tar -xzf patchsplit-macos-x86_64.tar.gz
chmod +x patchsplit
sudo install -m 755 patchsplit /usr/local/bin/patchsplit
patchsplit --version
xattr -d com.apple.quarantine /usr/local/bin/patchsplit

Windows

Expand-Archive .\patchsplit-windows-x86_64.zip -DestinationPath .\patchsplit
.\patchsplit\patchsplit.exe --version

Automation

Release flow

Push a v* tag to trigger GitHub Actions. The workflow builds Linux, macOS, and Windows archives and creates a draft GitHub Release for review.

git tag v0.1.0
git push origin v0.1.0

Keep Pull Request patches small enough to inspect.

Open the repository