Skip to main content

ghpr

"Clone" GitHub PRs/issues, locally edit title/description/comments, "push" back to GitHub, and mirror to Gists.

ghpr-py

  • Sometimes PR and issue descriptions/comments warrant more complex editing than GitHub's web UI comfortably allows.
  • ghpr lets you "clone" PRs and issues locally as Markdown files (including titles and comments), so you can edit them with your favorite IDE, then "push" updates back to GitHub.
  • ghpr also mirrors PR/issue content to Gists, for version control and easy sharing / backing up / syncing across machines.

Examples:

Features

  • Clone PR/Issues locally with comments
  • Sync bidirectionally between GitHub and local files
  • Diff local changes vs remote (with ownership warnings for others' comments)
  • Push updates back to GitHub
  • Gist mirroring for version control and sharing
  • Comment management - edit and sync PR/issue comments
  • Draft comments - create new*.md files, push to post as comments
  • Shell integration - aliases and tab completion for subcommands, flags, and options

Installation

pip install ghpr-py

Usage

Basic Workflow

# Clone a PR or issue (to `gh/123` by default)
ghpr clone https://github.com/owner/repo/pull/123
# or
ghpr clone owner/repo#123
# or, from inside a repo on a branch with an open PR, no args:
ghpr clone

# Make edits to:
# - Title / Description: `gh/123/repo#123.md`
# - Comment files: `zNNNNNN-<author>.md` (existing comments) or `new.md` (new comments)

# Show differences (between local "clone" and GitHub)
ghpr diff

# Push changes
ghpr push

Adding Comments

To add a new comment, create a file starting with new and ending in .md:

# Create a draft comment
echo "My comment text" > new.md

# Commit it
git add new.md
git commit -m "Draft comment"

# Push to GitHub (posts the comment and renames to z{id}-{author}.md)
ghpr push

The push command will:

  1. Post new*.md files as comments to GitHub
  2. Create a commit renaming them to z{comment_id}-{author}.md
  3. Sync to the gist mirror

Uploading Images

# Upload image(s) to this issue or PR's Gist mirror, and get markdown URLs
ghpr upload screenshot.png
# Output: ![screenshot.png](https://gist.githubusercontent.com/...)

Note: GitHub serves gist raw files as application/octet-stream, so images render in markdown but videos won't preview inline. For videos, use GitHub's native drag-drop upload in the web UI instead.

Directory Structure

Cloned PRs and issues are stored as:

gh/
  123/                    # Filed PRs/issues (numbered)
    repo#123.md           # Main description
    z3404494861-user.md   # Comments (ID-author format)
    z3407382913-user.md
  drafts/                 # In-flight drafts (not yet filed)
    my-feature/
      DESCRIPTION.md
  new/                    # Default single-draft slot (ghpr init with no arg)
    DESCRIPTION.md

Since PRs are issues in GitHub's API, we use the same gh/{number}/ pattern for both. Each gh/<number>/ and gh/drafts/<slug>/ is its own nested git repo, so the parent project can safely add gh/ to its .gitignore — ghpr clone and ghpr create set up nested git tracking automatically.

Parallel drafts

Pass a slug to stage multiple drafts at once:

ghpr init my-feature       # creates gh/drafts/my-feature/
ghpr init another-issue    # creates gh/drafts/another-issue/
ghpr create my-feature     # files the my-feature draft → renames to gh/<N>/

Shell Integration (Optional)

For users who want shorter aliases, ghpr provides shell integration:

Bash/Zsh

Add to your ~/.bashrc or ~/.zshrc:

eval "$(ghpr shell-integration bash)"

Fish

Add to your ~/.config/fish/config.fish:

ghpr shell-integration fish | source

Available Aliases

After enabling shell integration, you get convenient shortcuts and tab completion for subcommands, flags, and options:

ghprc      # ghpr clone (no args = clone branch's PR; + cd into directory)
ghpri      # ghpr init (+ cd into draft dir; pass slug for gh/drafts/<slug>/)
ghprcr     # ghpr create
ghprd      # ghpr diff
ghprp      # ghpr push
ghprl      # ghpr pull
ghpro      # ghpr open
ghprsh     # ghpr show
ghpru      # ghpr upload
ghia       # ghpr ingest-attachments
# ... and more (-n, -g, -o variants)

See the full list with:

ghpr shell-integration bash

Metadata

Release files for ghpr-py 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ghpr-py 0.2.0
File Size Uploaded
ghpr_py-0.2.0.tar.gz 72.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ghpr-py 0.2.0
File Interpreter ABI Platform
ghpr_py-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 136.3 kB

Release files / ghpr_py-0.2.0.tar.gz

Download URL ghpr_py-0.2.0.tar.gz
Size 72.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2843d2df38f823a2949d5c6846f4a7e061273a98669fe705136d177572052d8a
BLAKE2b-256 checksum
How to use checksums
44c7e3a71ff8457947f03deba80ddce2e08c720c4c19b1a03d76c2955da4f1eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release files / ghpr_py-0.2.0-py3-none-any.whl

Download URL ghpr_py-0.2.0-py3-none-any.whl
Size 63.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
135dcc5f48d2688f6bd36404d347ad03aa83b0bcfb94827218311a3a23790356
BLAKE2b-256 checksum
How to use checksums
df44158952e3874a9279e6500b51c78fcb80c7412afe2d73d43cafacfdaa21aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page