Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

patchsplit

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.

Usage

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-patches

The 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.

Options

  • -o, --out <dir>: Output directory for split patch files.
  • -f, --force: Overwrite existing patch files.
  • -h, --help: Show help.
  • -V, --version: Show version.

Dependencies

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.

Build

cargo build --release

The release binary is generated at:

target/release/patchsplit

Release

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.0

You 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.gz
  • patchsplit-macos-x86_64.tar.gz
  • patchsplit-windows-x86_64.zip

Releases are created as drafts, so they should be reviewed and published from the GitHub Releases page.

Install

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

If macOS blocks the downloaded binary, remove the quarantine attribute:

xattr -d com.apple.quarantine /usr/local/bin/patchsplit

Windows

Extract the archive in PowerShell:

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

To use it globally, add the extracted patchsplit directory to your user Path environment variable.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages