Stacking (Graphite CLI)
Viewing your stack
| Task | Command | Short Form |
|---|---|---|
| See full information about your branches, PRs, and worktree locations | gt log |
|
| See all of your branches | gt log short |
gt ls |
Creating and modifying branches
| Task | Command | Short Form |
|---|---|---|
| Create a new branch | gt create |
gt c |
| Create a branch on top of a branch checked out in another worktree | gt create --onto <branch> |
|
| Create a branch, stage all, commit with message | gt create --all --message "message" |
gt c -am "message" |
| Amend staged changes to current branch | gt modify |
gt m |
| Stage all changes and amend them to current branch | gt modify --all |
gt m -a |
| Add a new commit to current branch | gt modify --commit |
gt m -c |
| Stage all changes and add a new commit to current branch with message | gt modify --commit --all --message "message" |
gt m -cam "message" |
| Amend staged changes to a downstack branch | gt modify --into |
gt m --into |
Syncing and submitting
| Task | Command | Short Form |
|---|---|---|
| Pull trunk, clean up merged branches, restack | gt sync |
|
| Push current branch and all downstack branches to remote and create/update PRs | gt submit |
|
| Push all branches in current stack to remote and create/update PRs | gt submit --stack |
gt ss |
| Only push branches and update PRs for branches that already have PRs open | gt submit --stack --update-only |
gt ss -u |
Navigating your stack
| Task | Command | Short Form |
|---|---|---|
| Switch to a specific branch | gt checkout |
gt co |
| Move up one branch | gt up |
gt u |
| Move down one branch | gt down |
gt d |
| Move up/down multiple branches | gt up 3, gt down 2 |
gt u 3, gt d 2 |
| Go to the top of the stack | gt top |
gt t |
| Go to the bottom of the stack | gt bottom |
gt b |
Reorganizing your stack
| Task | Command | Short Form |
|---|---|---|
| Move branch to a new parent | gt move |
|
| Fold branch into its parent | gt fold |
|
| Delete branch but keep changes in working tree | gt pop |
|
| Reorder branches in your stack | gt reorder |
|
| Split branch into multiple branches | gt split |
gt sp |
| Squash all commits in branch into one | gt squash |
gt sq |
| Distribute staged changes to downstack branches by amending relevant commits | gt absorb |
gt ab |
Recovery
| Task | Command | Short Form |
|---|---|---|
| Undo the most recent Graphite mutation | gt undo |
Tracking branches
| Task | Command | Short Form |
|---|---|---|
| Start tracking an existing Git branch with Graphite | gt track |
gt tr |
| Stop tracking a branch | gt untrack |
gt utr |
Collaborating
| Task | Command | Short Form |
|---|---|---|
| Fetch a teammate’s stack locally | gt get |
|
| Freeze a branch to prevent accidental edits | gt freeze |
|
| Unfreeze a branch | gt unfreeze |