Git log with expanded PR commits. For repositories using squash merges, this shows the original PR commits indented under each squash-merged commit on main.
- Shows main branch commits with their associated PR commits expanded below
- Works with squash merges (
(#123)format) and merge commits (Merge pull request #123) - Full commit SHAs shown for PR commits (so you can
git checkout <sha>to inspect pre-squash commits) - Colored output matching git's color scheme
- Uses git's configured pager (
core.pager, e.g.,delta,less) - Falls back gracefully if
ghCLI is unavailable
- GitHub CLI (
gh) - authenticated with access to the repository - Bash 4+
View the gist: git-prlog
-
Clone the gist:
git clone git@gist.github.com:6eb3625fa02e1b072d65d5b53356aac1.git ~/src/git-prlog -
Symlink to a directory in your
$PATH(e.g.,~/binor~/.local/bin):ln -s ~/src/git-prlog/git-prlog ~/bin/git-prlog ln -s ~/src/git-prlog/git-prlog ~/bin/git-prls
-
Add aliases to your
~/.gitconfig:[alias] prlog = "!git-prlog" prls = "!git-prls"
-
(Optional) Add tig integration to your
~/.tigrc:# Show PR commits for squash-merged commit (extracts PR# from commit message) # Shows in terminal, press Enter to return to tig bind main P !sh -c "git-prls -1 %(commit)" bind diff P !sh -c "git-prls -1 %(commit)" bind log P !sh -c "git-prls -1 %(commit)"
| Command | Description |
|---|---|
git prls |
Short form - one line per commit + indented PR commits |
git prls -10 |
Last 10 commits |
git prlog |
Long form - full commit details + boxed PR commits |
git prlog main~5..main |
Specific commit range |
git prls --no-pager |
Disable pager |
git prls --debug |
Show diagnostic info |
All standard git log options work.
The full commit SHAs shown for PR commits can be fetched and checked out to inspect the original code before squashing:
# Fetch and checkout a PR commit in one command
git fetch origin <commit> && git checkout FETCH_HEAD
# Or separately
git fetch origin f6g7h8i
git checkout f6g7h8iThis is useful for reviewing the original commit history, bisecting issues, or cherry-picking specific changes.
Short form (git prls):
a1b2c3d4e5 (HEAD -> main) feat(auth): add user authentication (#42) [Alice]
├─ f6g7h8i feat(auth): add JWT token validation [Alice]
├─ j9k0l1m feat(auth): add login endpoint [Alice]
└─ n2o3p4q feat(auth): add user model [Alice]
b5c6d7e8f9 fix(db): resolve connection timeout (#41) [Bob]
├─ r5s6t7u fix(db): increase connection pool size [Bob]
└─ v8w9x0y fix(db): add retry logic [Bob]
Long form (git prlog):
commit a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0 (HEAD -> main)
Author: Alice
Date: Mon Jan 15 10:30:00 2024 -0500
feat(auth): add user authentication (#42)
Implement JWT-based authentication with login endpoint and token
validation. Includes user model with secure password hashing.
Closes #38
┌─ PR #42 commits:
│ commit f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5
│ Author: Alice
│ Date: Mon Jan 15 09:00:00 2024 -0500
│
│ feat(auth): add JWT token validation
│
│ commit j9k0l1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6b7
│ Author: Alice
│ Date: Sun Jan 14 16:30:00 2024 -0500
│
│ feat(auth): add login endpoint
│
│ commit n2o3p4q5r6s7t8u9v0w1x2y3z4a5b6c7d8e9f0
│ Author: Alice
│ Date: Sun Jan 14 14:00:00 2024 -0500
│
│ feat(auth): add user model
│
└─────────────────
Darcy Parker - GitHub
Vibe programmed with Claude