Language: English | Simplified Chinese
patchsplit is a Rust CLI that downloads a GitHub Pull Request .patch file
and splits it into one patch file per commit.
patchsplit <owner/repo> <pr-number> [--out <dir>] [--force]
patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force]Examples:
patchsplit rust-lang/rust 12345
patchsplit openai codex 42 -o pr-42-patchesThe default output directory is patches/. Output files are named with a
four-digit index and the commit subject:
patches/
0001-add-parser.patch
0002-wire-cli.patch
Existing output files are not overwritten by default. Pass --force to replace
them.
-o, --out <dir>: Output directory for split patch files.-f, --force: Overwrite existing patch files.-h, --help: Show help.-V, --version: Show version.
The current implementation does not use third-party Rust crates. It calls the
system curl command to download GitHub .patch files, so curl must be
available in PATH at runtime.
cargo build --releaseThe release binary is generated at:
target/release/patchsplit
Pushing a v* tag triggers GitHub Actions to build release packages for three
platforms and automatically create a GitHub draft release:
git tag v0.1.0
git push origin v0.1.0You can also run the Release workflow manually from GitHub Actions. Select the
branch or commit to package, then enter the release tag. If the tag does not
exist, it will point to the workflow commit. The workflow creates these files:
patchsplit-linux-x86_64.tar.gzpatchsplit-macos-x86_64.tar.gzpatchsplit-windows-x86_64.zip
Releases are created as drafts, so they should be reviewed and published from the GitHub Releases page.
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 --versionIf macOS blocks the downloaded binary, remove the quarantine attribute:
xattr -d com.apple.quarantine /usr/local/bin/patchsplitExtract the archive in PowerShell:
Expand-Archive .\patchsplit-windows-x86_64.zip -DestinationPath .\patchsplit
.\patchsplit\patchsplit.exe --versionTo use it globally, add the extracted patchsplit directory to your user Path
environment variable.