Skip to content

Documentation

Command Reference

Complete reference for all gs commands and their flags.

Core Commands

CommandAliasDescription
gs initInitialize gs in a repository
gs create <name>Create a new stacked branch
gs track [branch]Track an existing branch
gs checkout <branch>co, switchSwitch to a branch
gs logVisualize the stack structure
gs infoShow current branch details

Navigation

CommandAliasDescription
gs up [n]uMove up toward leaves
gs down [n]dnMove down toward trunk
gs toptJump to top of stack
gs bottombJump to trunk
gs parentShow parent branch
gs childrenShow child branches

Stack Operations

CommandAliasDescription
gs stack restackstack r, stack fix, stack fRebase stack to maintain relationships
gs modifymAmend commit and restack children
gs move [target]mvMove branch to different parent
gs foldFold current branch into parent
gs delete [branch]d, rmDelete branch from stack
gs splitSplit branch into multiple branches
gs rename <name>Rename the current branch
gs syncFetch remote, clean stale branches, delete merged, and restack
gs mcpStart the MCP server for AI agent integration

Split Modes

FlagDescription
-cSplit by selecting commits
-uInteractive hunk selection
-f "*.json"Split files matching pattern
-n baseSpecify new branch name
gs split -c              # Split by selecting commits
gs split -u              # Interactive hunk selection
gs split -f "*.json"     # Split files matching pattern
gs split -n base         # Specify new branch name

Log Modes

FlagDescription
--shortCompact view (default)
--longDetailed view with commit messages

Checkout Flags

FlagLongDescription
-t--trunkQuick checkout to trunk
-u--show-untrackedShow untracked branches in selection
-s--stackOnly show branches in current stack

Modify Flags

FlagLongDescription
-a--allStage all changes before committing
-p--patchInteractively stage changes
-c--commitCreate new commit instead of amending
-m--messageSpecify commit message

Move Flags

FlagLongDescription
-o--ontoSpecify target branch

Delete / Fold / Sync Flags

CommandFlagLongDescription
gs delete-f--forceDelete without confirmation
gs fold-f--forceSkip confirmation prompt
gs fold-k--keepKeep branch instead of deleting
gs sync-f--forceForce cleanup without prompts