Two input styles
Use owner/repo with a PR number, or pass owner, repo, and PR number as separate arguments.
Rust CLI for GitHub PR patch streams
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.patchPatchsplit
The tool keeps the workflow explicit: fetch the pull request patch, split by commit boundaries, and write predictable files without surprise overwrites.
Use owner/repo with a PR number, or pass owner, repo, and PR number as separate arguments.
Each file starts with a four-digit index and a sanitized commit subject, such as 0001-add-parser.patch.
Existing output files are protected by default. Add --force only when replacing them is intentional.
The current implementation uses no third-party Rust crates and calls the system curl command for HTTPS downloads.
Flow
Patchsplit builds the GitHub .patch URL from the repository and PR number.
curl follows redirects, fails on HTTP errors, and identifies itself with the patchsplit version.
Mail-style From markers define commit boundaries. A raw single patch is kept as one file.
Output lands in patches/ by default, or in the directory supplied with --out.
CLI
Run either command shape, then pick the output directory behavior you need.
patchsplit <owner/repo> <pr-number> [--out <dir>] [--force]
patchsplit rust-lang/rust 12345patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force]
patchsplit openai codex 42 -o pr-42-patchesPackages
Release archives are produced for Linux, macOS, and Windows from v* tags.
tar -xzf patchsplit-linux-x86_64.tar.gz
chmod +x patchsplit
sudo install -m 755 patchsplit /usr/local/bin/patchsplit
patchsplit --versiontar -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/patchsplitExpand-Archive .\patchsplit-windows-x86_64.zip -DestinationPath .\patchsplit
.\patchsplit\patchsplit.exe --versionAutomation
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