Agent Skill
2/7/2026

git-spice

This skill should be used when the user asks about "stacked branches", "git-spice", "gs command", "stacked PRs", "stacked pull requests", "stacked merge requests", "branch stacks", "restack branches", "submit stack", "gs branch", "gs stack", "gs upstack", "gs downstack", "gs repo sync", or needs help managing multiple dependent branches.

A
alexeldeib
1GitHub Stars
1Views
npx skills add alexeldeib/clode

SKILL.md

Namegit-spice
DescriptionThis skill should be used when the user asks about "stacked branches", "git-spice", "gs command", "stacked PRs", "stacked pull requests", "stacked merge requests", "branch stacks", "restack branches", "submit stack", "gs branch", "gs stack", "gs upstack", "gs downstack", "gs repo sync", or needs help managing multiple dependent branches.

name: git-spice description: >- This skill should be used when the user asks about "stacked branches", "git-spice", "gs command", "stacked PRs", "stacked pull requests", "stacked merge requests", "branch stacks", "restack branches", "submit stack", "gs branch", "gs stack", "gs upstack", "gs downstack", "gs repo sync", or needs help managing multiple dependent branches. version: 0.1.0

git-spice CLI

git-spice (gs) is a CLI tool for managing stacked Git branches. It tracks relationships between branches, enables easy navigation, and creates stacked Pull Requests on GitHub or Merge Requests on GitLab.

Key Concepts

  • Stack: Collection of branches stacked on top of each other
  • Trunk: The default branch (main/master) with no base
  • Upstack: Branches above the current branch
  • Downstack: Branches below the current branch (not including trunk)
  • Restacking: Rebasing a branch onto its base to maintain linear history

Command Reference

Repository Commands (gs repo / gs r)

CommandShorthandDescription
gs repo initgs riInitialize git-spice in a repository
gs repo syncgs rsPull latest changes, delete merged branches
gs repo restackgs rrRestack all tracked branches

Branch Commands (gs branch / gs b)

CommandShorthandDescription
gs branch create <name>gs bcCreate and track a new stacked branch
gs branch trackgs btTrack an existing branch
gs branch untrackgs butStop tracking a branch (keep in Git)
gs branch checkout <name>gs bcoCheck out a branch (interactive if no name)
gs branch delete <name>gs bdDelete a tracked branch
gs branch rename <new>gs brnRename the current branch
gs branch submitgs bsSubmit current branch as a CR
gs branch restackgs brRestack current branch onto its base
gs branch editgs beInteractive rebase of branch commits
gs branch squashgs bsqSquash all commits in current branch
gs branch splitgs bspSplit branch into multiple branches
gs branch onto <base>gs boMove branch to a different base
gs branch foldgs bfFold branch into its base

Stack Commands (gs stack / gs s)

CommandShorthandDescription
gs stack submitgs ssSubmit all branches in the stack
gs stack restackgs srRestack all branches in the stack
gs stack editgs seEdit order of branches in the stack
gs stack deletegs sdDelete all branches in the stack

Upstack Commands (gs upstack / gs us)

CommandShorthandDescription
gs upstack submitgs ussSubmit current branch and those above
gs upstack restackgs usrRestack current branch and upstack
gs upstack onto <base>gs usoMove branch and upstack to new base
gs upstack deletegs usdDelete all branches above current

Downstack Commands (gs downstack / gs ds)

CommandShorthandDescription
gs downstack submitgs dssSubmit current branch and those below
gs downstack trackgs dstTrack multiple branches at once
gs downstack editgs dseEdit order of downstack branches

Commit Commands (gs commit / gs c)

CommandShorthandDescription
gs commit creategs ccCommit and restack upstack branches
gs commit amendgs caAmend last commit and restack
gs commit splitgs cspSplit last commit into two
gs commit fixupgs cfCreate a fixup commit
gs commit pickgs cpCherry-pick commits into branch

Navigation Commands

CommandShorthandDescription
gs upgs uMove up one branch in the stack
gs downgs dMove down one branch in the stack
gs topgs UMove to top of stack
gs bottomgs DMove to bottom of stack
gs trunk-Move to trunk branch

Log Commands (gs log / gs l)

CommandShorthandDescription
gs log shortgs lsShow branches as a tree
gs log longgs llShow branches with commits

Add --all to show all stacks, not just the current one. Add --json for machine-readable output.

Authentication (gs auth)

CommandDescription
gs auth loginAuthenticate with GitHub/GitLab
gs auth logoutLog out from the service
gs auth statusShow authentication status

Rebase Commands (gs rebase / gs rb)

CommandShorthandDescription
gs rebase continuegs rbcContinue interrupted rebase
gs rebase abortgs rbaAbort the current rebase

Common Workflows

Create a New Stack

# Start from trunk
gs trunk

# Create first feature branch
git add file.txt
gs branch create feat1

# Stack another branch on top
git add another.txt
gs branch create feat2

Submit a Stack for Review

# Submit entire stack
gs stack submit

# Or submit with auto-filled PR info
gs stack submit --fill

Modify Mid-Stack and Update

# Navigate to the branch to modify
gs down  # or: gs bco feat1

# Make changes and commit
git add file.txt
gs commit create -m "fix typo"

# Submit updates to all CRs
gs stack submit

Sync After Merges

# Pull latest, delete merged branches, restack remaining
gs repo sync

Move a Branch to Different Base

# Move current branch and upstack to main
gs upstack onto main

# Move only current branch (leave upstack in place)
gs branch onto main

Split a Branch

# Interactively split current branch at commit boundaries
gs branch split

Common Flags

  • --fill / -c: Auto-fill CR info from commits
  • --draft / --no-draft: Set CR draft status
  • --force: Force push (override safety checks)
  • --update-only: Only update existing CRs, don't create new ones
  • -n / --dry-run: Show what would happen without doing it
  • --no-prompt: Disable interactive prompts

Configuration

Set options with git config:

# Create branches without committing by default
git config spice.branchCreate.commit false

# Add prefix to all created branches
git config spice.branchCreate.prefix "user/"

# Create CRs as drafts by default
git config spice.submit.draft true

# Open browser when CR is created
git config spice.submit.web created

# Add default labels to all CRs
git config spice.submit.label "needs-review"

# Add default reviewers
git config spice.submit.reviewers "alice,myorg/team"

Tips

  • Use --help on any command to see its shorthand
  • Interactive prompts provide fuzzy search for branch selection
  • Navigation commands accept -n to print target without switching
  • Use gs bco without arguments for an interactive branch picker
Skills Info
Original Name:git-spiceAuthor:alexeldeib