rung
A Git workflow tool for managing stacked PRs (pull request chains).
Overview
Rung helps you work with dependent branches by:
- Tracking branch relationships in a stack
- Syncing child branches when parents are updated
- Managing PR chains on GitHub with automatic stack comments
- Handling merges with automatic descendant rebasing
Installation
Pre-built binaries (recommended)
Download the latest release for your platform from GitHub Releases.
macOS (Apple Silicon):
|
macOS (Intel):
|
Linux (x86_64):
|
Windows: Download the .zip from releases and add to your PATH.
From crates.io
With cargo-binstall (faster, no compilation)
From source
Quick Start
# Initialize rung in a repository
# Create your first stacked branch
# Make changes, commit, then create another branch on top
# Submit all branches as PRs
# View stack status
Commands
rung init
Initialize rung in the current repository. Creates a .git/rung/ directory to store stack state.
rung create <name>
Create a new branch with the current branch as its parent. This establishes the branch relationship in the stack.
rung status
Display the current stack as a tree view with sync state and PR status.
Options:
--fetch- Fetch latest PR status from GitHub--json- Output as JSON (for tooling integration)
rung sync
Sync the stack by rebasing all branches when the base moves forward.
If conflicts occur:
# Resolve conflicts, then:
# Or abort and restore:
Options:
--dry-run- Show what would be done without making changes--continue- Continue after resolving conflicts--abort- Abort and restore from backup-b, --base <branch>- Base branch to sync against (default: "main")
rung submit
Push all stack branches and create/update PRs on GitHub. Each PR includes a stack comment showing the branch hierarchy.
Options:
--draft- Create PRs as drafts--force- Force push even if remote has changes-t, --title <title>- Custom PR title for current branch
rung merge
Merge the current branch's PR via GitHub API. Automatically:
- Rebases all descendant branches onto the new base
- Updates PR bases on GitHub
- Removes the branch from the stack
- Deletes local and remote branches
- Pulls latest changes to keep local up to date
Options:
-m, --method <method>- Merge method:squash(default),merge, orrebase--no-delete- Don't delete the remote branch after merge
rung undo
Undo the last sync operation, restoring all branches to their previous state.
rung nxt
Navigate to the next (child) branch in the stack.
rung prv
Navigate to the previous (parent) branch in the stack.
rung doctor
Diagnose issues with the stack and repository. Checks:
- Stack integrity: Branches exist, parents are valid, no circular dependencies
- Git state: Clean working directory, not detached HEAD, no rebase in progress
- Sync state: Branches that need rebasing, sync operations in progress
- GitHub connectivity: Authentication, PR status (open/closed/merged)
Issues are reported with severity (error/warning) and actionable suggestions.
Typical Workflow
# Start on main
# Initialize rung (first time only)
# Create first feature branch
# Make changes and commit
&&
# Create dependent branch
# Make more changes
&&
# Submit both as PRs
# After review, merge from bottom of stack
# Continue with remaining PRs
Stack Comments
When you submit PRs, rung adds a comment to each PR showing the stack hierarchy:
### Stack
- API Tests #124 👈
- API Client #123
- `main`
---
*Managed by [rung](https://github.com/auswm85/rung)*
Configuration
Rung stores its state in .git/rung/:
stack.json- Branch relationships and PR numbersconfig.json- Repository-specific settingsbackups/- Sync backup data for undo
Requirements
- Rust 1.85+
- Git 2.x
- GitHub CLI (
gh) authenticated, orGITHUB_TOKENenvironment variable
Project Structure
crates/
rung-cli/ # Command-line interface
rung-core/ # Core logic (stack, sync, state)
rung-git/ # Git operations wrapper
rung-github/ # GitHub API client
Development
# Clone and set up git hooks
# Run tests
# Run with clippy
# Build release
License
MIT