gitprint
Convert git repositories into beautifully formatted, printer-friendly PDFs — or preview them directly in the terminal.
Features
- Syntax-highlighted source code with 100+ languages supported
- Configurable color themes (InspiredGitHub, Solarized, base16, and more)
- Table of contents and directory tree visualization
- Single-file mode — print just one file, no cover page or TOC overhead
- Plain directory support — works on any folder, not just git repos
- Automatic binary and minified file detection and exclusion
- Glob-based include/exclude filtering
- Multiple paper sizes (A4, Letter, Legal) and landscape mode
- Branch and commit selection for printing specific revisions
- Embedded JetBrains Mono font for crisp code rendering
- Async pipeline — metadata, file reads, and highlighting run concurrently
- Terminal preview mode — inspect repo or user data in the terminal without generating a PDF
- GitHub user report mode — generate a PDF (or preview) of a user's activity, repos, and recent commits
Installation
With Nix
With Cargo
With Docker
No install needed — pull the latest nightly image from GitHub Container Registry and mount your repository:
--rmremoves the container after use-w /reposets the working directory inside the container so.resolves correctly-v "$(pwd):/repo"mounts the current directory; the output PDF is written back to it
Usage
Repository Mode (Default)
# Generate PDF from current directory (or git repo)
# Print a single file
# Print any directory (no git required)
# Print a remote repository
# Output to a specific file
# Include only Rust and TOML files
# Exclude test files
# Use a different theme
# List available themes
# Use Letter paper in landscape
# Print a specific branch or commit
# Minimal output: no TOC, no file tree, no line numbers
User Report Mode
# Generate a GitHub user activity report PDF
# Limit the activity date range
# Show only push events (commits), not issues/PRs/stars
# Include more repos and commits in the report
# Skip commit diffs for a faster, lighter report
# Increase GitHub API rate limits with a personal access token
GITHUB_TOKEN=ghp_...
Preview Mode
Preview shows all the same data as the PDF — metadata, directory tree, file list with LOC/sizes, or GitHub user activity — directly in the terminal without writing any file.
# Preview a repository in the terminal
# Preview a remote repository
# Preview a GitHub user report
# Combine with other flags — filters and date ranges all apply
CLI Reference
Convert git repositories into beautifully formatted PDFs.
MODES
gitprint <PATH> [OPTIONS]
Local path, file, or remote URL (https://, git@, ssh://) → PDF
gitprint --user <USERNAME> [OPTIONS]
GitHub user activity report → PDF
gitprint <PATH|--user USERNAME> --preview
Preview output in the terminal — no PDF generated
Usage: gitprint [OPTIONS] [PATH]
Arguments:
[PATH]
Local path, file, or remote URL (https://, git@, ssh://)
Options:
--preview Preview output in the terminal instead of generating a PDF
-o, --output <PATH> Output PDF file path
-h, --help Print help
-V, --version Print version
Repository Mode (Default):
--include <PATTERN> Glob patterns for files to include (repeatable)
--exclude <PATTERN> Glob patterns for files to exclude (repeatable)
--theme <NAME> Syntax highlighting theme [default: InspiredGitHub]
--font-size <SIZE> Code font size in points [default: 8]
--no-line-numbers Disable line numbers
--no-toc Disable table of contents
--no-file-tree Disable directory tree visualization
--branch <NAME> Use a specific branch
--commit <HASH> Use a specific commit
--paper-size <SIZE> Paper size [default: a4] [possible values: a4, letter, legal]
--landscape Use landscape orientation
--list-themes List available syntax themes and exit
--list-tags List version tags of the repository and exit
User Report Mode:
-u, --user <USERNAME> GitHub username — generate a user activity report
--last-repos <N> Most-recently-pushed repos to include [default: 5]
--last-commits <N> Recent commits with diffs to render [default: 5]
--no-diffs Skip commit diff rendering (faster)
--since <DATE> Show events from this date forward
--until <DATE> Show events up to and including this date
--activity <TYPE> Event types: all (default) or commits
--events <N> Max events shown in activity feed [default: 30]
Date formats for --since / --until
| Format | Example |
|---|---|
| ISO date | 2024-01-15 or 2024-01-15T00:00:00Z |
| Keywords | today, yesterday |
| Named | last week, last month, last year |
| Relative | 30 days ago, 2 weeks ago, 1 month ago |
Development
Donate
If gitprint saves you time, consider sponsoring development:
GitHub Sponsors has zero platform fees — 100% goes to the developer.
License
MIT