npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

patchgen

v1.0.0

Published

A CLI tool to generate .patch files from git repositories

Downloads

191

Readme

patchgen

A guided CLI to generate Git patch files from staged changes and branch diffs.

patchgen helps developers generate .patch files with a cleaner and more guided workflow than manually typing Git patch commands.

Quick start

npx patchgen

Or install globally:

npm install -g patchgen
patchgen

Features

  • Generate patches from staged changes
  • Generate patches from branch diffs
  • Include all files or select specific files to include
  • Guided interactive CLI
  • Predictable .patch output flow

Why use patchgen?

You can always generate patches with raw Git commands. patchgen makes that workflow easier and more consistent by reducing command memorization and guiding you through patch creation step by step.

Patch files are also a practical way to share code changes with LLMs and AI assistants. Instead of pasting raw diffs or multiple files, a single .patch file gives the model a structured, complete picture of what changed — making it easier to get accurate reviews, suggestions, or explanations.

Supported flows

Staged changes

Generate a patch from files already staged in Git (git diff --cached).

Compare branches

Generate a patch from the diff between a base branch and a feature branch (git format-patch).

File selection

In both flows, after choosing the patch type, you can decide which files to include:

  • Include all files — uses all changed files
  • Select files to include — shows a multi-select list to pick specific files

Note: When using "Select files to include" in Compare branches mode, the patch is generated with git diff instead of git format-patch, so commit messages will not be included in the output.

Example

Staged — include all files

◆ patchgen — Generate .patch files from your git repository
✔ Git repository detected.

◆ Select patch type:
● Staged changes — Generate a patch from staged files
○ Compare branches — ...

◆ Which files to include?
● Include all files
○ Select files to include

◆ Output file name: › staged.patch

┌ Summary
│ Patch type: Staged changes
│ Output file: staged.patch
└

✔ Generate patch? Yes

✔ Collecting staged changes...
✔ Done.
✔ Writing file...
✔ Patch saved to staged.patch

◆ All done!

Compare branches — select files

◆ patchgen — Generate .patch files from your git repository
✔ Git repository detected.

◆ Select patch type:
○ Staged changes — ...
● Compare branches — Generate a patch from commits in a feature branch not present in a base branch

◆ Base branch: › main
◆ Feature branch: › feat/login

◆ Which files to include?
○ Include all files
● Select files to include

┌ Note
│ When selecting specific files in branch compare mode,
│ commit messages will not be included in the patch.
└

◆ Select files to include:
◼ src/auth/login.ts
◼ src/auth/utils.ts
◻ src/config.ts

◆ Output file name: › main-feat-login.patch

┌ Summary
│ Patch type: Compare branches
│ Base branch: main
│ Feature branch: feat/login
│ Files selected: 2 files
│ Note: Commit messages not included
│ Output file: main-feat-login.patch
└

✔ Generate patch? Yes

✔ Generating patch...
✔ Done.
✔ Writing file...
✔ Patch saved to main-feat-login.patch

◆ All done!

Requirements

  • Git
  • Node.js 18+

Current limitations

  • Interactive-first workflow — scripted/piped mode is not yet supported
  • Output directory is always the current working directory
  • No diff preview before saving
  • No support for generating multiple patch files in a single run

Roadmap

  • Non-interactive mode for use in CI pipelines
  • --output <dir> flag
  • Config file support (.patchgenrc)
  • Colorized diff preview
  • Shell completions for branch names

Flow diagram

flowchart TD
    A([Start]) --> B{Select patch type}
    B -->|Staged changes| C[Detect staged files]
    B -->|Compare branches| D[Enter base & feature branches]
    D --> E[Detect changed files]
    C --> F{Which files to include?}
    E --> F
    F -->|Include all files| G[Enter output file name]
    F -->|Select files to include| H[Choose files from list]
    H --> G
    G --> I[Show summary]
    I --> J{Confirm?}
    J -->|Yes| K[Run git command]
    J -->|No| L([Cancel])
    K --> M[Write .patch file]
    M --> N([Done])

Contributing

Issues and pull requests are welcome.

License

MIT