Note

This reference reflects the updated Graphite commands as of V1.0.0, which was released on 2023-09-13. The legacy commands will still be functional, but the CLI will prompt you to use the new command names. We will eventually deprecate the legacy commands in future versions.

See more information about the legacy command names.


Global flags

NameDefaultTypeDescription
--cwdnullstringWorking directory in which to perform operations.
--debugfalsebooleanWrite debug output to a file.
--interactivetruebooleanEnable interactive features like prompts, pagers, and editors. Enabled by default. Disable with --no-interactive.
--verifytruebooleanEnable git hooks. Enabled by default. Disable with --no-verify.
--quietfalsebooleanMinimize output to the terminal. Implies --no-interactive.

Available commands

gt aliases

Edit your command aliases.

Flags

nametypedescription
--resetbooleanReset your alias configuration.

gt auth

Add your auth token to enable Graphite CLI to create and update your PRs on GitHub.

Flags

namealiastypedescription
--token-tstringAuth token. Get it from: https://app.graphite.dev/activate

gt bottom
gt b

Switch to the first branch from trunk in the current stack.

gt changelog

Show the Graphite CLI changelog.

gt checkout [branch]
gt co

Switch to a branch. If no branch is provided, opens an interactive selector.

branch (optional)
The branch to checkout.

Flags

namealiastypedescription
--show-untracked-ubooleanInclude untracked branches in interactive selection.

gt children

Show the children of the current branch.

gt completion

gt config

Configure the Graphite CLI.

gt continue
gt cont

Continues the most recent Graphite command halted by a rebase conflict.

Flags

namealiastypedescription
--all-abooleanStage all changes before continuing.

gt create [name]
gt c

Create a new branch stacked on top of the current branch and commit staged changes. If no branch name is specified, generate a branch name from the commit message. If your working directory contains no changes, an empty branch will be created. If you have any unstaged changes, you will be asked whether you'd like to stage them.

name (optional)
The name of the new branch.

Flags

namealiastypedescription
--all-abooleanStage all unstaged changes before creating the branch, including to untracked files.
--insert-ibooleanInsert this branch between the current branch and its child. If there are multiple children, prompts you to select which should be moved onto the new branch.
--message-mstringSpecify a commit message.
--patch-pbooleanPick hunks to stage before committing.

gt dash

Opens your Graphite dashboard.

gt delete [name]
gt dl

Delete a branch and its Graphite metadata. Children will be restacked onto the parent branch. If the branch is not merged or closed, prompts for confirmation.

name (optional)
The name of the branch to delete. If no branch is provided, opens an interactive selector.

Flags

namealiastypedescription
--force-fbooleanDelete the branch even if it is not merged or closed.

gt docs

Show the Graphite CLI docs.

gt down [steps]
gt d

Switch to the parent of the current branch.

Flags

namealiastypedescription
--steps-nnumberThe number of levels to traverse downstack.

gt feedback [message]

Post a string directly to the maintainers' Slack so they can drown in praise, factor in your feedback, laugh at your jokes, cry at your insults, or fall victim to Slack injection attacks.

message (optional)
Positive or constructive feedback for the Graphite team! Jokes are chill too.

Flags

nametypedescription
--print-debug-contextbooleanPrint a debug summary of your repo. Useful for creating bug report details.
--with-debug-contextbooleanInclude a blob of json describing your repo's state to help with debugging. Run 'gt feedback --print-debug-context' to see what would be included.

gt fish

Set up fish tab completion.

gt fold

Fold a branch's changes into its parent, update dependencies of descendants of the new combined branch, and restack.

Flags

namealiastypedescription
--keep-kbooleanKeeps the name of the current branch instead of using the name of its parent.

gt get [branch]

Get branches from trunk to the specified branch from remote, prompting the user to resolve conflicts. If no branch is provided, get downstack from the current branch.

branch (optional)
Branch to get from remote.

Flags

namealiastypedescription
--force-fbooleanOverwrite all fetched branches with remote source of truth

gt info

Display information about the current branch.

Flags

namealiastypedescription
--body-bbooleanShow the PR body, if it exists.
--diff-dbooleanShow the diff between this branch and its parent. Takes precedence over patch.
--patch-pbooleanShow the changes made by each commit.
--stat-sbooleanShow a diffstat instead of a full diff. Modifies either --patch or --diff. If neither is passed, implies --diff.

gt init

Initialize Graphite in this repository by selecting a trunk branch. Can also be used to change the trunk branch of the repository.

Flags

nametypedescription
--resetbooleanUntrack all branches.
--trunkstringThe name of your trunk branch. If no name is passed, you will be prompted to select one interactively.

gt log [command]
gt l

Commands that log your stacks. Has three forms, gt log, gt log short, and gt log long. gt log long ignores all options and displays a graph of the commit ancestry of all branches. gt log and gt log short display all tracked branches and their dependency relationships. The difference between the latter two is that gt log displays more information about each branch. gt ls and gt ll are default aliases for gt log short and gt log long, respectively.

Flags

namealiastypedescription
--classicbooleanUse the old short logging style, which runs out of screen real estate more quickly. Other options will not work in classic mode.
--reverse-rbooleanPrint the log upside down. Handy when you have a lot of branches!
--show-untracked-ubooleanInclude untracked branches in the log.
--stack-sbooleanOnly show ancestors and descendants of the current branch.
--steps-nnumberOnly show this many levels upstack and downstack. Implies --stack.

gt merge

Merge the pull requests associated with all branches from trunk to the current branch via Graphite.

Flags

namealiastypedescription
--confirm-cbooleanAsks for confirmation before merging branches. Prompts for confirmation if the local branches differ from remote, regardless of the value of this flag.
--dry-runbooleanReports the PRs that would be merged and terminates. No branches are merged.

gt modify
gt m

Modify the current branch by amending its commit or creating a new commit. Automatically restacks descendants. If you have any unstaged changes, you will be asked whether you'd like to stage them.

Flags

namealiastypedescription
--all-abooleanStage all changes before committing.
--commit-cbooleanCreate a new commit instead of amending the current commit. If this branch has no commits, this command always creates a new commit.
--edit-ebooleanIf passed, open an editor to edit the commit message. When creating a new commit, this flag is ignored.
--interactive-rebasebooleanIgnore all other flags and start a git interactive rebase on the commits in this branch.
--message-mstringThe message for the new or amended commit. If passed, no editor is opened.
--patch-pbooleanPick hunks to stage before committing.

gt move

Rebase the current branch onto the target branch and restack all of its descendants. If no branch is passed in, opens an interactive selector.

Flags

namealiastypedescription
--onto-ostringBranch to move the current branch onto.
--sourcestringBranch to move (defaults to current branch).

gt parent

Show the parent of the current branch.

gt pop

Delete the current branch but retain the state of files in the working tree.

gt pr [branch]

Opens the pull request page for a branch or PR number. If no branch is passed, the current branch's PR is opened.

branch (optional)
A branch name or PR number to open.

gt rename [name]
gt rn

Rename a branch and update metadata referencing it. If no branch name is supplied, you will be prompted for a new branch name. Note that this removes any association to a pull request, as GitHub pull request branch names are immutable.

name (optional)
The new name for the current branch.

Flags

namealiastypedescription
--force-fbooleanAllow renaming a branch that is already associated with an open GitHub pull request.

gt reorder

Reorder branches between trunk and the current branch, restacking all of their descendants. Opens an editor where you can reorder branches by moving around a line corresponding to each branch.

gt restack
gt r

Ensure each branch in the current stack has its parent in its Git commit history, rebasing if necessary. If conflicts are encountered, you will be prompted to resolve them via an interactive Git rebase.

Flags

nametypedescription
--branchstringWhich branch to run this command from. Defaults to the current branch.
--downstackbooleanOnly restack this branch and its ancestors.
--onlybooleanOnly restack this branch.
--upstackbooleanOnly restack this branch and its descendants.

gt revert [sha]

Create a branch that reverts a commit on the trunk branch. Currently experimental.

sha (optional)
The commit to revert.

Flags

namealiastypedescription
--edit-ebooleanEdit the commit message.

gt split
gt sp

Split the current branch into multiple single-commit branches.

Flags

namealiastypedescription
--by-commit-c , --commit booleanSplit by commit - slice up the history of this branch.
--by-hunk-h , --hunk booleanSplit by hunk - split into new single-commit branches.

gt squash
gt sq

Squash all commits in the current branch into a single commit and restack upstack branches.

Flags

namealiastypedescription
--editbooleanModify the existing commit message.
--message-mstringThe updated message for the commit.
--no-edit-nbooleanDon't modify the existing commit message. Takes precedence over --edit

gt submit
gt s

Idempotently force push all branches from trunk to the current branch to GitHub, creating or updating distinct pull requests for each. Validates that branches are properly restacked before submitting, and fails if there are conflicts. Blocks force pushes to branches that overwrite branches that have changed since you last submitted or got them. Opens an interactive prompt that allows you to input pull request metadata. gt ss is a default alias for gt submit --stack.

Flags

namealiastypedescription
--alwaysbooleanAlways push updates, even if the branch has not changed. Can be helpful for fixing an inconsistent Graphite stack view on Web/GitHub resulting from downtime/a bug.
--branchstringWhich branch to run this command from. Defaults to the current branch.
--confirm-cbooleanReports the PRs that would be submitted and asks for confirmation before pushing branches and opening/updating PRs. If either of --no-interactive or --dry-run is passed, this flag is ignored.
--draft-dbooleanIf set, marks all PRs being submitted as draft. If --no-interactive is true, new PRs will be created in draft mode.
--dry-runbooleanReports the PRs that would be submitted and terminates. No branches are restacked or pushed and no PRs are opened or updated.
--edit-ebooleanInput metadata for all PRs interactively. If neither --edit nor --no-edit is passed, only prompts for new PRs.
--force-fbooleanForce push: overwrites the remote branch with your local branch. Otherwise defaults to --force-with-lease.
--merge-when-ready-mbooleanIf set, marks all PRs being submitted as merge when ready, which will let them automatically merge as soon as all merge requirements are met.
--no-edit-nbooleanDon't edit any PR fields inline. Takes precedence over --edit
--publish-pbooleanIf set, publishes all PRs being submitted. If --no-interactive is true, new PRs will be created in draft mode.
--rerequest-reviewbooleanRerequest review from current reviewers
--reviewers-rstringIf set without an argument, prompt to manually set reviewers. Alternatively, accepts a comma separated string of reviewers
--stack-sbooleanSubmit descendants of the current branch in addition to its ancestors.
--update-only-ubooleanOnly push branches and update PRs for branches that already have PRs open.

gt sync

Pull the trunk branch from remote and prompt to delete any branches that have been merged. Restacks all branches in your repository that can be restacked without conflicts. If trunk cannot be fast-forwarded to match remote, overwrites trunk with the remote version.

Flags

namealiastypedescription
--deletebooleanDelete merged branches (true by default; skip with --no-delete).
--force-fbooleanDon't prompt for confirmation before deleting a branch or overwriting trunk to match remote if it can't be fast-forwarded.
--pullbooleanPull the trunk branch from remote (true by default; skip with --no-pull).
--restackbooleanRestack any branches that can be restacked without conflicts (true by default; skip with --no-restack).
--show-delete-progressbooleanShow progress through merged branches.

gt top
gt t

Switch to the tip branch of the current stack. Prompts if ambiguous.

gt track [branch]
gt tr

Start tracking the current (or provided) branch with Graphite by selecting its parent. Can recursively track a stack of branches by specifying each branch's parent interactively. This command can also be used to fix corrupted Graphite metadata.

branch (optional)
Branch to begin tracking. Defaults to the current branch.

Flags

namealiastypedescription
--force-fbooleanSets the parent to the most recent tracked ancestor of the branch being tracked to skip prompts. Takes precedence over --parent
--parent-pstringThe tracked branch's parent. Must be set to a tracked branch. If provided, only one branch can be tracked at a time.

gt trunk

Switch to the trunk branch.

gt untrack [branch]
gt utr

Stop tracking a branch with Graphite. If the branch has children, they will also be untracked. Default to the current branch if none is passed in.

branch (optional)
Branch to stop tracking.

Flags

namealiastypedescription
--force-fbooleanWill not prompt for confirmation before untracking a branch with children.

gt up [steps]
gt u

Switch to the child of the current branch. Prompts if ambiguous.

Flags

namealiastypedescription
--steps-nnumberThe number of levels to traverse upstack.