ptchwrk
v0.3.0
Published
Patchwork - Manage patches on top of upstream repositories
Maintainers
Readme
Patchwork
Manage patches on top of upstream repositories.
Package name:
ptchwrk(becausepatchworkwas taken)
Why?
When you maintain local patches on top of an upstream repo (like a fork with custom features), rebasing gets messy. Patchwork exports your changes as patch files that can be cleanly reapplied whenever upstream updates.
Install
# npm
npm install -g ptchwrk
# or run directly
bunx ptchwrkUsage
# Initialize in your repo (config stored in ~/.local/share/patchwork/)
ptchwrk init
# Or store config in repo for committed forks
ptchwrk init --tracked
# Export a branch as a patch
ptchwrk export my-feature-branch
# Fetch upstream and apply all patches
ptchwrk sync
# Check status
ptchwrk status
# Remove a merged patch
ptchwrk drop 001-my-feature-branch.patchHow it works
- init - Creates config pointing to your upstream branch
- export - Generates a
.patchfile from commits unique to a branch (vs upstream) - sync - Fetches upstream, creates a fresh build branch, applies all patches in order
- status - Shows current patches and their sizes
- drop - Removes a patch file (use after upstream merges your PR)
Config Location
By default, Patchwork stores config externally to keep your repo clean:
~/.local/share/patchwork/<owner>/<repo>/
├── config.json
└── patches/Use --tracked to store config in the repo (for committed forks):
<repo>/.ptchwrk/
├── config.json
└── patches/Config Format
{
"upstream": {
"remote": "origin",
"branch": "main"
},
"buildBranch": "patchwork-build",
"patchDir": "patches"
}License
MIT
