Rebuild and push an entire stack after local changes.
gh-stack autorebase 'STACK-ID' -C /path/to/repo
gh-stack autorebase 'STACK-ID' -C /path/to/repo --ci # skip confirmation
gh-stack autorebase 'STACK-ID' -C /path/to/repo -b <sha> # cherry-pick boundary- Checks out the base branch (e.g.,
main) - Cherry-picks commits from each PR in stack order
- Updates local branches to point at new commits
- Force-pushes all branches at once
This reconstructs a clean, linear stack from your local changes.
| Flag | Description |
|---|---|
-C, --project |
Path to local repository (required) |
--ci |
Skip confirmation prompt |
-b, --initial-cherry-pick-boundary |
Stop initial cherry-pick at this SHA |
-o, --origin |
Git remote name (default: origin) |
-r, --repository |
Override repository (owner/repo) |
-e, --excl |
Exclude PR by number (repeatable) |
If a conflict occurs during cherry-picking:
- The process pauses
- Resolve conflicts manually
- Stage resolved files with
git add - Continue with
git cherry-pick --continue
After amending a commit in the middle of your stack:
# Your local history diverged from remote
git checkout feat/part-1
git commit --amend -m "Updated message"
# Rebuild and sync the entire stack
gh-stack autorebase 'STACK-ID' -C .- Force-pushes to all branches in the stack
- Back up your work before running
- Collaborators will need to reset their local branches
- After amending commits
- After interactive rebase
- After resolving conflicts with upstream
- After reordering commits