Core Commands
| Command | Alias | Description |
|---|
gs init | | Initialize gs in a repository |
gs create <name> | | Create a new stacked branch |
gs track [branch] | | Track an existing branch |
gs checkout <branch> | co, switch | Switch to a branch |
gs log | | Visualize the stack structure |
gs info | | Show current branch details |
Navigation
| Command | Alias | Description |
|---|
gs up [n] | u | Move up toward leaves |
gs down [n] | dn | Move down toward trunk |
gs top | t | Jump to top of stack |
gs bottom | b | Jump to trunk |
gs parent | | Show parent branch |
gs children | | Show child branches |
Stack Operations
| Command | Alias | Description |
|---|
gs stack restack | stack r, stack fix, stack f | Rebase stack to maintain relationships |
gs modify | m | Amend commit and restack children |
gs move [target] | mv | Move branch to different parent |
gs fold | | Fold current branch into parent |
gs delete [branch] | d, rm | Delete branch from stack |
gs split | | Split branch into multiple branches |
gs rename <name> | | Rename the current branch |
gs sync | | Fetch remote, clean stale branches, delete merged, and restack |
gs mcp | | Start the MCP server for AI agent integration |
Split Modes
| Flag | Description |
|---|
-c | Split by selecting commits |
-u | Interactive hunk selection |
-f "*.json" | Split files matching pattern |
-n base | Specify 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
| Flag | Description |
|---|
--short | Compact view (default) |
--long | Detailed view with commit messages |
Checkout Flags
| Flag | Long | Description |
|---|
-t | --trunk | Quick checkout to trunk |
-u | --show-untracked | Show untracked branches in selection |
-s | --stack | Only show branches in current stack |
Modify Flags
| Flag | Long | Description |
|---|
-a | --all | Stage all changes before committing |
-p | --patch | Interactively stage changes |
-c | --commit | Create new commit instead of amending |
-m | --message | Specify commit message |
Move Flags
| Flag | Long | Description |
|---|
-o | --onto | Specify target branch |
Delete / Fold / Sync Flags
| Command | Flag | Long | Description |
|---|
gs delete | -f | --force | Delete without confirmation |
gs fold | -f | --force | Skip confirmation prompt |
gs fold | -k | --keep | Keep branch instead of deleting |
gs sync | -f | --force | Force cleanup without prompts |