Manage stacked Git branches and create multiple pull requests using git-spice (gs). Use when organizing feature branches into stacks, rebasing changes across branches, creating PR chains, navigating branch stacks, or managing dependent branches on GitHub/GitLab. Handles stacked PRs, branch restacking, and stack submission workflows.
Manages stacked Git branches and creates PR chains using git-spice (gs). Use when organizing features into reviewable stacks, rebasing branches, navigating upstack/downstack, or submitting dependent PRs on GitHub/GitLab.
/plugin marketplace add abatilo/vimrc/plugin install abatilo-core@abatilo-pluginsThis skill is limited to using the following tools:
reference/commands.mdreference/workflows.mdThis skill helps you manage stacked Git branches using git-spice (gs), a CLI tool for creating, navigating, and submitting branch stacks as pull requests.
Use this skill when:
Stacked Branches: A series of branches where each branch is based on the previous one, forming a dependency chain rooted at trunk (main/master).
┌── feat3 (#3) <- top of stack
┌─┴ feat2 (#2)
┌─┴ feat1 (#1) <- bottom of stack
main <- trunk
Trunk: The main development branch (main, master, or configured trunk).
Upstack/Downstack: Branches above/below the current branch in the stack.
gs repo init
This sets up git-spice tracking in your repository. You'll be prompted to select the trunk branch and remote.
# Start from trunk
git checkout main
# Create first branch in stack
gs branch create feat1 -m "Add user model"
# Create second branch stacked on feat1
gs branch create feat2 -m "Add user API"
# Create third branch stacked on feat2
gs branch create feat3 -m "Add user tests"
gs up # Move up one branch (u)
gs down # Move down one branch (d)
gs top # Jump to top of stack (U)
gs bottom # Jump to bottom of stack (D)
gs trunk # Return to trunk branch
gs log short # List all tracked branches (ls)
gs log long # Show branches with commits (ll)
gs stack submit # Submit entire stack as PRs (ss)
gs branch submit # Submit current branch only (bs)
gs upstack submit # Submit current and all above (uss)
gs downstack submit # Submit current and all below (dss)
gs repo sync # Pull latest, delete merged branches (rs)
gs stack restack # Rebase all branches onto latest (sr)
| Command | Shorthand | Description |
|---|---|---|
gs branch create | gs bc | Create new branch |
gs branch checkout | gs bco | Switch to branch |
gs branch submit | gs bs | Submit branch as PR |
gs branch restack | gs br | Rebase branch on base |
gs branch delete | gs bd | Delete branch |
gs branch onto | gs bon | Move branch onto another |
gs branch edit | gs be | Interactive rebase |
gs stack submit | gs ss | Submit entire stack |
gs stack restack | gs sr | Restack entire stack |
gs upstack submit | gs uss | Submit upstack |
gs upstack restack | gs usr | Restack upstack |
gs downstack submit | gs dss | Submit downstack |
gs repo sync | gs rs | Sync with remote |
gs repo init | gs ri | Initialize repo |
gs commit create | gs cc | Create commit |
gs commit amend | gs ca | Amend commit |
gs log short | gs ls | List branches |
gs log long | gs ll | List with commits |
# Start from updated trunk
gs trunk
git pull
# Create logical branches for each reviewable piece
gs bc api-models -m "Add data models for new API"
gs bc api-handlers -m "Implement API handlers"
gs bc api-tests -m "Add API integration tests"
# View your stack
gs ll
# Navigate to branch that needs changes
gs bco api-handlers
# Make changes, then amend or create new commit
gs ca # amend current commit
# or
gs cc -m "Address review feedback"
# Restack all branches above to incorporate changes
gs usr # upstack restack
# Sync repo - pulls trunk, deletes merged branches
gs rs
# Restack all tracked branches onto new trunk
gs repo restack
# or for just current stack:
gs sr
# Move current branch onto a different base
gs bon main # Move onto main directly
gs bon other-feature # Move onto another branch
# Insert a new branch in the middle of a stack
gs bc new-branch --insert # Restacks upstack onto new branch
When restacking encounters conflicts:
# Resolve conflicts in your editor
git status # See conflicted files
# ... fix conflicts ...
git add <resolved-files>
# Continue the restack operation
gs rebase continue # (gs rbc)
# Or abort if needed
gs rebase abort # (gs rba)
# Submit all branches in stack as linked PRs
gs ss
# Submit with draft PRs
gs ss --draft
# Submit only current branch
gs bs
# Update PR after changes
gs bs # Re-run submit updates existing PR
# Track a single branch
gs branch track feature-branch --base main
# Track all branches in a downstack
gs downstack track
# Split current branch into multiple commits
gs branch split
# Squash branch into single commit
gs branch squash
# Delete a single branch
gs bd feature-branch
# Delete entire upstack
gs upstack delete
# Delete entire stack
gs stack delete
gs auth login # Authenticate with GitHub/GitLab
gs auth status # Check current auth status
gs auth logout # Clear credentials
Git-spice uses git config for settings:
# Set branch name prefix
git config spice.branchCreate.prefix "username/"
# Configure navigation comment style
git config spice.submit.navigationComment multiple
# View all spice config
git config --get-regexp spice
# Track an existing branch
gs branch track my-branch --base main
# After resolving conflicts
gs rebase continue
# To abort and try different approach
gs rebase abort
gs repo sync # Fetch and sync
gs repo restack # Restack all branches
After restacking, branches need force push:
gs bs --force # Submit handles force push
# or manually:
git push --force-with-lease
For detailed information on specific topics, see:
gs ss to create linked PRsgs rs to stay current with upstreamThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.