> ## Documentation Index
> Fetch the complete documentation index at: https://graphite-58cc94ce.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Cheatsheet

Common tasks and their commands. Click any command to see full documentation in the [command reference](/command-reference).

<Note>Graphite fully supports multiple Git worktrees. Starting in `gt` version `1.8.4`, Graphite does not modify branches checked out in another worktree in most cases. See [Work in multiple Git worktrees](/multiple-worktrees) for details.</Note>

## Viewing your stack

| Task                                                                  | Command               | Short Form |
| --------------------------------------------------------------------- | --------------------- | ---------- |
| See full information about your branches, PRs, and worktree locations | [`gt log`][log]       |            |
| See all of your branches                                              | [`gt log short`][log] | `gt ls`    |

## Creating and modifying branches

| Task                                                                  | Command                                                  | Short Form            |
| --------------------------------------------------------------------- | -------------------------------------------------------- | --------------------- |
| Create a new branch                                                   | [`gt create`][create]                                    | `gt c`                |
| Create a branch on top of a branch checked out in another worktree    | [`gt create --onto <branch>`][create]                    |                       |
| Create a branch, stage all, commit with message                       | [`gt create --all --message "message"`][create]          | `gt c -am "message"`  |
| Amend staged changes to current branch                                | [`gt modify`][modify]                                    | `gt m`                |
| Stage all changes and amend them to current branch                    | [`gt modify --all`][modify]                              | `gt m -a`             |
| Add a new commit to current branch                                    | [`gt modify --commit`][modify]                           | `gt m -c`             |
| Stage all changes and add a new commit to current branch with message | [`gt modify --commit --all --message "message"`][modify] | `gt m -cam "message"` |
| Amend staged changes to a downstack branch                            | [`gt modify --into`][modify]                             | `gt m --into`         |

## Syncing and submitting

| Task                                                                           | Command                                     | Short Form |
| ------------------------------------------------------------------------------ | ------------------------------------------- | ---------- |
| Pull trunk, clean up merged branches, restack                                  | [`gt sync`][sync]                           |            |
| Push current branch and all downstack branches to remote and create/update PRs | [`gt submit`][submit]                       |            |
| Push all branches in current stack to remote and create/update PRs             | [`gt submit --stack`][submit]               | `gt ss`    |
| Only push branches and update PRs for branches that already have PRs open      | [`gt submit --stack --update-only`][submit] | `gt ss -u` |

## Navigating your stack

| Task                           | Command                              | Short Form         |
| ------------------------------ | ------------------------------------ | ------------------ |
| Switch to a specific branch    | [`gt checkout`][checkout]            | `gt co`            |
| Move up one branch             | [`gt up`][up]                        | `gt u`             |
| Move down one branch           | [`gt down`][down]                    | `gt d`             |
| Move up/down multiple branches | [`gt up 3`][up], [`gt down 2`][down] | `gt u 3`, `gt d 2` |
| Go to the top of the stack     | [`gt top`][top]                      | `gt t`             |
| Go to the bottom of the stack  | [`gt bottom`][bottom]                | `gt b`             |

## Reorganizing your stack

| Task                                                                         | Command                 | Short Form |
| ---------------------------------------------------------------------------- | ----------------------- | ---------- |
| Move branch to a new parent                                                  | [`gt move`][move]       |            |
| Fold branch into its parent                                                  | [`gt fold`][fold]       |            |
| Delete branch but keep changes in working tree                               | [`gt pop`][pop]         |            |
| Reorder branches in your stack                                               | [`gt reorder`][reorder] |            |
| Split branch into multiple branches                                          | [`gt split`][split]     | `gt sp`    |
| Squash all commits in branch into one                                        | [`gt squash`][squash]   | `gt sq`    |
| Distribute staged changes to downstack branches by amending relevant commits | [`gt absorb`][absorb]   | `gt ab`    |

## Recovery

| Task                                   | Command           | Short Form |
| -------------------------------------- | ----------------- | ---------- |
| Undo the most recent Graphite mutation | [`gt undo`][undo] |            |

## Tracking branches

| Task                                                | Command                 | Short Form |
| --------------------------------------------------- | ----------------------- | ---------- |
| Start tracking an existing Git branch with Graphite | [`gt track`][track]     | `gt tr`    |
| Stop tracking a branch                              | [`gt untrack`][untrack] | `gt utr`   |

## Collaborating

| Task                                        | Command                   | Short Form |
| ------------------------------------------- | ------------------------- | ---------- |
| Fetch a teammate's stack locally            | [`gt get`][get]           |            |
| Freeze a branch to prevent accidental edits | [`gt freeze`][freeze]     |            |
| Unfreeze a branch                           | [`gt unfreeze`][unfreeze] |            |

[log]: /command-reference#gt-log-%5Bcommand%5D

[create]: /command-reference#gt-create-%5Bname%5D

[modify]: /command-reference#gt-modify

[sync]: /command-reference#gt-sync

[submit]: /command-reference#gt-submit

[up]: /command-reference#gt-up-%5Bsteps%5D

[down]: /command-reference#gt-down-%5Bsteps%5D

[top]: /command-reference#gt-top

[bottom]: /command-reference#gt-bottom

[checkout]: /command-reference#gt-checkout-%5Bbranch%5D

[move]: /command-reference#gt-move

[fold]: /command-reference#gt-fold

[pop]: /command-reference#gt-pop

[reorder]: /command-reference#gt-reorder

[split]: /command-reference#gt-split

[squash]: /command-reference#gt-squash

[absorb]: /command-reference#gt-absorb

[track]: /command-reference#gt-track-%5Bbranch%5D

[untrack]: /command-reference#gt-untrack-%5Bbranch%5D

[get]: /command-reference#gt-get-%5Bbranch%5D

[freeze]: /command-reference#gt-freeze-%5Bbranch%5D

[unfreeze]: /command-reference#gt-unfreeze-%5Bbranch%5D

[undo]: /command-reference#gt-undo
