A syntax-highlighting pager for git, diff, grep and blame output, configured as a drop-in replacement for git's default pager.
modem-dev/hunk
Interactive terminal diff viewer for reviewing code changes from Git, Jujutsu, Sapling, GitHub PRs, and raw files, with inline agent notes.
- Stars
- 9,782
- Forks
- 326
- Open issues
- 183
- Last commit
- 15 hours ago
What is it?
Hunk is a terminal diff viewer built for reviewing code changes, including changes made by AI coding agents. It presents a multi-file review stream with a sidebar for navigating between files, and offers split, unified, and responsive automatic layouts.
It auto-detects Git, Jujutsu, and Sapling checkouts, so commands like hunk diff, hunk show, and hunk log work with revsets or commit history. A bundled hunk gh command opens pull requests, commits, and comparisons from GitHub, and hunk open browses directories or displays full syntax-highlighted files. Watch mode reloads reviews as the working tree changes.
Hunk can be used as a Git, Jujutsu, or Sapling pager, and its inline annotations let agents attach notes beside the relevant code. Configuration is stored in TOML, keybindings can be remapped, and an experimental TypeScript extension API is available.
Key features
- 01Multi-file review stream with sidebar navigation
- 02Split, unified, and responsive automatic layouts
- 03Inline AI and agent annotations beside the code
- 04Watch mode that reloads file and Git-backed reviews
- 05Support for Git, Jujutsu, and Sapling, plus GitHub PR review via hunk gh
Use cases
- Reviewing changes produced by an AI coding agent before committing
- Reading uncommitted or untracked changes in a terminal-based workflow
- Using Hunk as the pager for git diff, jj, or Sapling output
- Comparing two raw files or a patch piped from stdin
Quick start
- 1
Install Hunk with npm (requires Node.js 22+)
npm i -g hunkdiff - 2
Check that Hunk is installed
hunk --version - 3
Review the current repository's changes in a Git repo
hunk diff
Things to know
- Prebuilt binaries are not published for Windows on arm64 or for musl-based Linux such as Alpine.
- GitHub Enterprise is not currently supported by hunk gh.
- The extension API is experimental and may change in breaking ways between minor releases.
In collections
Topics
FAQ
- What is hunk?
- Interactive terminal diff viewer for reviewing code changes from Git, Jujutsu, Sapling, GitHub PRs, and raw files, with inline agent notes. Hunk is a terminal diff viewer built for reviewing code changes, including changes made by AI coding agents. It presents a multi-file review stream with a sidebar for navigating between files, and offers split, unified, and responsive automatic layouts.
- Is hunk free to use? What license does it have?
- hunk is open source under the MIT license. Check the license terms before using it in commercial products.
- Is hunk still maintained?
- Actively maintained. The last commit to hunk was on Nov 6, 2026.
- What can I use hunk for?
- Reviewing changes produced by an AI coding agent before committing Reading uncommitted or untracked changes in a terminal-based workflow Using Hunk as the pager for git diff, jj, or Sapling output Comparing two raw files or a patch piped from stdin
- How do I install hunk?
- Install Hunk with npm (requires Node.js 22+): npm i -g hunkdiff Check that Hunk is installed: hunk --version Review the current repository's changes in a Git repo: hunk diff
- Where can I get hunk?
- The source code and installation instructions are on GitHub: https://github.com/modem-dev/hunk
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A git pager that renders diffs side by side with syntax highlighting in the terminal, GitHub-style.
A content-aware diff tool in Rust that compares code structurally with tree-sitter and also diffs pictures, fonts, archives and PDFs.
A CLI tool that opens a local GitHub-style web viewer for reviewing git commit diffs, with comments you can copy as AI prompts.
A terminal code review tool with vim keybindings that exports comments to GitHub, GitLab, Gitea, Bitbucket, Azure DevOps, Gerrit, or the clipboard.
A command-line diff tool that compares files by their syntax tree instead of lines, so reformatting and moved code show up accurately.