Visualize your stack's structure and status.
# Infer stack from current branch (recommended)
gh-stack log
# Infer from a specific branch
gh-stack log --branch feat/my-feature
# List all stacks and select interactively
gh-stack log --all
# Search by identifier in PR titles
gh-stack log 'STACK-ID'
# CI mode (non-interactive)
gh-stack log --branch $GITHUB_HEAD_REF --ciWhen run without an identifier, gh-stack log automatically discovers your stack by:
- Finding the PR for your current branch
- Walking up the PR base chain to find ancestors
- Walking down to find PRs that build on yours
This works with any PR structure - no special naming required.
The default tree view shows:
◉ feat/part-3 (current)
│ 2 hours ago
│
│ a1b2c3d - Add validation logic
│ f4e5d6c - Update tests
│
◯ feat/part-2
│ 3 hours ago
│
◯ feat/part-1 (draft)
│ 5 hours ago
│
◯ main
◉marks the current branch◯marks other branches- Commits are shown when run from a git repo
- Timestamps show when each PR was last updated
- Draft PRs are labeled
The --short flag shows a compact list:
#103: [STACK-ID] Add validation (Merges into #102)
#102: [STACK-ID] Implement feature (Merges into #101)
#101: [STACK-ID] Initial scaffolding (Base)
| Flag | Description |
|---|---|
--branch, -b |
Infer stack from this branch instead of current |
--all, -a |
List all stacks and select interactively |
--ci |
Non-interactive mode for CI environments |
--trunk |
Override trunk branch (default: auto-detect or "main") |
--short, -s |
Compact list format instead of tree |
--status |
Show CI, approval, and merge status bits |
--include-closed |
Show branches with closed/merged PRs |
--no-color |
Disable colors and unicode characters |
-C, --project |
Path to local repository |
-r, --repository |
Override repository (owner/repo) |
-o, --origin |
Git remote name (default: origin) |
-e, --excl |
Exclude PR by number (repeatable) |
In CI environments, use --ci to disable interactive prompts:
# Must provide branch explicitly
gh-stack log --branch $GITHUB_HEAD_REF --ci
# Or use identifier
gh-stack log 'STACK-ID' --ciThe --ci flag will:
- Fail with an error if no identifier or branch is provided
- Fail if on a trunk branch without an identifier
- Never prompt for user input
When you're on a trunk branch (main, master, etc.), gh-stack log will prompt you to:
- Enter a stack identifier manually
- Select from detected stacks in the repository
- Cancel
You're on 'main' (trunk branch).
? What would you like to do?
> Enter a stack identifier
Select from detected stacks (3 found)
Cancel
If no PR exists for your current branch:
No PR found for branch 'feat/new-feature'.
Create a PR with:
gh pr create --base main --head feat/new-feature
? Create PR now? [Y/n]
If you confirm, gh-stack will run gh pr create for you.
- Before rebasing to understand stack structure
- To check which PRs are open, merged, or draft
- To see recent commits on each branch
- To verify stack order before landing