Convert GitHub pull requests into a single Markdown file you can review locally. Useful for offline or local AI review workflows with tools like opencode, GitHub Copilot CLI, and your own scripts.
- Reuse existing GitHub credentials.
- Export PR details, threads and summaries as Markdown.
- Filter threads by status and write to a file or stdout.
- Use GitHub Enterprise and local credential storage with restricted permissions.
gem install git-markdowngit-markdown setupFrom inside a git repository:
git-markdown pr 123Or specify the repo:
git-markdown pr owner/repo#123It saves PR-{number}-{title}.md in the current directory by default.
# Export PR from current repository
git-markdown pr 123
# Export PR from a specific repository
git-markdown pr owner/repo#123
# Output to stdout (useful for piping)
git-markdown pr 123 --stdout | pbcopy # macOS; on Linux use `xclip`/`wl-copy` or redirect to a file
# Save to a directory
git-markdown pr 123 --output ./reviews/
# Filter comment threads (default: unresolved)
git-markdown pr 123 --status=unresolved
git-markdown pr 123 --status=resolved
git-markdown pr 123 --status=all
# Debug output
git-markdown pr 123 --debug
# Show version
git-markdown versiongit-markdown looks for a GitHub token in this order:
GITHUB_TOKENorGH_TOKENenvironment variables- Git credential store (
git credential fill) - GitHub CLI (
gh auth token) - Token saved by
git-markdown setup
If you see a prompt for a GitHub username or an askpass error, set GITHUB_TOKEN or GH_TOKEN in your environment to skip git credential prompts.
Set your API URL:
export GITHUB_API_URL=https://github.yourcompany.com/api/v3
git-markdown pr owner/repo#123The generated Markdown includes:
- PR metadata (title, author, status, created date)
- PR description (full body)
- Review comments grouped by file with line numbers
- General discussion comments
- Review summaries (approvals, change requests)
Threads marked with [resolved] or [done] are filtered out by default. Use --status=all to include them.
Config is stored under ~/.config/git-markdown/:
config.ymlfor settings (provider, API URL, defaults)credentialsfor the token (permissions: 0600)
- Ruby 4.0+
- Git (for remote detection)
- GitHub Personal Access Token with
reposcope
- Fork it
- Create a branch (
git checkout -b feature/my-feature) - Commit your changes
- Push (
git push origin feature/my-feature) - Open a Pull Request
Please use Conventional Commits for commit messages.
- GitLab Merge Request support (
git-markdown mr) - GitLab and GitHub Issue support (
git-markdown issue) - Custom templates
- Optional diff in output
- GitHub REST API docs: docs.github.com/en/rest
- GitHub CLI auth token: cli.github.com/manual/gh_auth_token
- Git credential interface: git-scm.com/docs/git-credential
- XDG Base Directory spec: specifications.freedesktop.org/basedir-spec
- RubyGems: rubygems.org/gems/git-markdown
MIT License, see LICENSE.txt
Shared tooling uses published Ethos Gemkit. Keep the exact Gemfile version and workflow commit pins on the same release.
bundle install
bundle exec lefthook install
bundle exec rake verifyRelease preparation, publication, registry setup and recovery are documented in the Gemkit release guide.