A local git diff viewer that opens a GitHub-style UI in the browser.
go install github.com/yasaricli/bak@latestRequires Go 1.21+ and git in your PATH.
bak # working tree (unstaged changes)
bak --staged # staged changes
bak HEAD # last commit
bak HEAD~2 # two commits ago
bak HEAD~3..HEAD # range between commitsPrerequisites: Go 1.21+ and git in your PATH.
Clone and build locally:
git clone https://github.com/yasaricli/bak.git
cd bak
go build -o bak .
./bak # run from the project directoryRun without building:
go run . --stagedRun tests:
go test ./...To install your local build into $GOPATH/bin:
go install .- Runs
git diffwith the given arguments - Parses the unified diff output
- Starts a local HTTP server on a random available port
- Opens the browser automatically (
openon macOS) - Serves a single self-contained HTML page
- Shuts down once the browser loads the page (or on Ctrl-C)
- Dark theme (GitHub dark style)
- Left sidebar listing changed files with
+/-counts - Clicking a file jumps to that section; active file tracks scroll
- Unified diff with old/new line numbers
- Added lines in green, removed lines in red
- File type icons
- Zero external dependencies — pure HTML/CSS/JS embedded in the binary
bak/
├── main.go # CLI entry point, arg parsing
└── internal/
├── diff/
│ └── diff.go # unified diff parser
├── render/
│ └── render.go # HTML/CSS/JS page builder
└── server/
└── server.go # one-shot HTTP server
MIT