Command reference
This reference documents every command and flag available in Graphite’s command-line interface.

Follow the installation guide to set up the Graphite CLI.

Flags
--helpShow help for a command.
--allCommandsThis is not printed with the global help, but if passed to gt --help --all, will print out the full list of command help.
--cwdWorking directory in which to perform operations.
--debugWrite debug output to the terminal.
--interactiveEnable interactive features like prompts, pagers, and editors. Enabled by default. Disable with `--no-interactive`.
--verifyEnable git hooks. Enabled by default. Disable with `--no-verify`.
--quietMinimize output to the terminal. Implies `--no-interactive`.

Amend staged changes to the relevant commits in the current stack. Relevance is calculated by checking the changes in each commit downstack from the current commit, and finding the first commit that each staged hunk (consecutive lines of changes) can be applied to deterministically. If there is no clear commit to absorb a hunk into, it will not be absorbed. Prompts for confirmation before amending the commits, and restacks the branches upstack of the current branch.

Flags
-a, --allStage all unstaged changes before absorbing. Unlike create and modify, this will not include untracked files, as file creations would never be absorbed.
-d, --dry-run
-f, --force
-p, --patchPick hunks to stage before absorbing.

Edit your command aliases.

Flags
--legacyAppend legacy aliases to your configuration. See https://graphite.dev/docs/legacy-alias-preset for more details.
--resetReset your alias configuration.

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

Flags
-t, --tokenAuth token. Get it from: https://app.graphite.dev/activate

Switch to the branch closest to trunk in the current stack.

Show the Graphite CLI changelog.

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

Arguments
[branch] (optional)The branch to checkout.
Flags
-u, --show-untrackedInclude untracked branches in interactive selection.

Show the children of the current branch.

Set up bash or zsh tab completion.

Configure the Graphite CLI.

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

Flags
-a, --allStage all changes before continuing.

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.

Arguments
[name] (optional)The name of the new branch.
Flags
--aiAutomatically AI-generate the branch name and the commit message (if unset)
-a, --allStage all unstaged changes before creating the branch, including to untracked files.
-i, --insertInsert 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.
-m, --messageSpecify a commit message.
--no-aiDo not automatically AI-generate the branch name and the commit message. Takes precedence over --ai.
-p, --patchPick hunks to stage before committing.
-u, --updateStage all updates to tracked files before creating the branch.

Opens your Graphite dashboard.

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.

Arguments
[name] (optional)The name of the branch to delete. If no branch is provided, opens an interactive selector.
Flags
-f, --forceDelete the branch even if it is not merged or closed.

Run interactive demos in any repo to learn how to use the Graphite CLI. This will teach you how to create pull requests & stacks with Graphite.

Usage:
1. gt demo pull-request: Learn how to create a PR
2. gt demo stack: Learn how to create a stack of PRs

Arguments
[demoName] (optional)Demo to run

Show the Graphite CLI docs.

Switch to the parent of the current branch.

Flags
-n, --stepsThe number of levels to traverse downstack.

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.

Arguments
[message] (optional)Positive or constructive feedback for the Graphite team! Jokes are chill too.
Flags
--with-debug-contextInclude logs from the past 24 hours in your feedback. This can help us understand what's going on in your repo.

Set up fish tab completion.

Fold a branch's changes into its parent, update dependencies of descendants of the new combined branch, and restack. This is useful when you have a branch that is no longer needed and you want to combine its changes with its parent branch. This command does not perform any action on GitHub or the remote repository. If you fold a branch with an open pull request, you will need to manually close the pull request.

Flags
-k, --keepKeeps the name of the current branch instead of using the name of its parent.

For a given branch or PR number, sync branches from trunk to the given branch from remote, prompting the user to resolve any conflicts. If the branch already exists locally, upstack branches are also synced, unless --downstack is provided. If no branch is provided, sync the current stack.

Arguments
[branch] (optional)Branch or PR number to get from remote.
Flags
-d, --downstackWhen syncing a branch that already exists locally, don't sync upstack branches.
-f, --forceOverwrite all fetched branches with remote source of truth
--restackRestack any branches in the stack that can be restacked without conflicts (true by default; skip with --no-restack).

Read extended guides on how to use the gt program.

Display information about the current branch.

Flags
-b, --bodyShow the PR body, if it exists.
-d, --diffShow the diff between this branch and its parent. Takes precedence over patch.
-p, --patchShow the changes made by each commit.
-s, --statShow a diffstat instead of a full diff. Modifies either --patch or --diff. If neither is passed, implies --diff.

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

Flags
--resetUntrack all branches.
--trunkThe name of your trunk branch. If no name is passed, you will be prompted to select one interactively.

Start Graphite Interactive

Flags
--commandOverride the path used to invoke the Graphite CLI.
--cwdSets the current working directory, allowing changing the repo.
--forceKill any existing Graphite Interactive server on the specified port, then start a new server. Note that this will disrupt other windows still using the previous Graphite Interactive server.
-f, --foregroundRun the server process in the foreground.
--killDo not start Graphite Interactive, just kill any previously running Graphite Interactive server on the specified port. Note that this will disrupt other windows still using the previous Graphite Interactive server.
--no-openDo not try to open a browser after starting the server.
-p, --portPort to run Graphite Interactive on
--stdoutWrite server logs to stdout instead of a tmp file.

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.

Arguments
[command] (optional)
Flags
--classicUse the old short logging style, which runs out of screen real estate more quickly. Other options will not work in classic mode.
-r, --reversePrint the log upside down. Handy when you have a lot of branches!
-u, --show-untrackedInclude untracked branched in the log.
-s, --stackOnly show ancestors and descendants of the current branch.
-n, --stepsOnly show this many levels upstack and downstack. Implies --stack.

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

Flags
-c, --confirmAsks for confirmation before merging branches. Prompts for confirmation if the local branches differ from remote, regardless of the value of this flag.
--dry-runReports the PRs that would be merged and terminates. No branches are merged.

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
-a, --allStage all changes before committing.
-c, --commitCreate a new commit instead of amending the current commit. If this branch has no commits, this command always creates a new commit.
-e, --editIf passed, open an editor to edit the commit message. When creating a new commit, this flag is ignored.
--interactive-rebaseIgnore all other flags and start a git interactive rebase on the commits in this branch.
-m, --messageThe message for the new or amended commit. If passed, no editor is opened.
-p, --patchPick hunks to stage before committing.
-u, --updateStage all updates to tracked files before committing.

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
-o, --ontoBranch to move the current branch onto.
--sourceBranch to move (defaults to current branch).

Show the parent of the current branch.

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

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

Arguments
[branch] (optional)A branch name or PR number to open.
Flags
--stackOpen the stack page.

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.

Arguments
[name] (optional)The new name for the current branch.
Flags
-f, --forceAllow renaming a branch that is already associated with an open GitHub pull request.

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.

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
--branchWhich branch to run this command from. Defaults to the current branch.
--downstackOnly restack this branch and its ancestors.
--onlyOnly restack this branch.
--upstackOnly restack this branch and its descendants.

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

Arguments
[sha] (optional)The commit to revert.
Flags
-e, --editEdit the commit message.

Split the current branch into multiple single-commit branches.

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

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

Flags
--editModify the existing commit message.
-m, --messageThe updated message for the commit.
-n, --no-editDon't modify the existing commit message. Takes precedence over --edit

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
--aiAutomatically AI-generate title and description for all PRs. Only works when creating new PRs. If --edit, use the generated metadata as starting points.
--alwaysAlways 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.
--branchWhich branch to run this command from. Defaults to the current branch.
--cliEdit PR metadata via the CLI instead of on web.
--commentAdd a comment on the PR with the given message.
-c, --confirmReports 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.
-d, --draftIf set, all new PRs will be created in draft mode.
--dry-runReports the PRs that would be submitted and terminates. No branches are restacked or pushed and no PRs are opened or updated.
-e, --editInput metadata for all PRs interactively. If neither --edit nor --no-edit is passed, only prompts for new PRs.
--edit-descriptionInput the PR description interactively. Default only prompts for new PRs. Takes precedence over --no-edit.
--edit-titleInput the PR title interactively. Default only prompts for new PRs. Takes precedence over --no-edit.
-f, --forceForce push: overwrites the remote branch with your local branch. Otherwise defaults to --force-with-lease.
-m, --merge-when-readyIf 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-aiDon't use AI to generate any PR fields. Takes precedence over --ai.
-n, --no-editDon't edit any PR fields inline. Takes precedence over --edit.
--no-edit-descriptionDon't prompt for the PR description. Takes precedence over --edit-description and --edit.
--no-edit-titleDon't prompt for the PR title. Takes precedence over --edit-title and --edit.
-p, --publishIf set, publishes all PRs being submitted.
--rerequest-reviewRerequest review from current reviewers.
--restackRestack branches before submitting. If there are conflicts, output the branch names that could not be restacked
-r, --reviewersIf set without an argument, prompt to manually set reviewers. Alternatively, accepts a comma separated string of reviewers
-s, --stackSubmit descendants of the current branch in addition to its ancestors.
-t, --team-reviewersComma separated list of team slugs. You can either pass "slug" to this flag or "org/slug" to the reviewers flag. Will enable the --reviewers prompt if set without arguments.
-u, --update-onlyOnly push branches and update PRs for branches that already have PRs open.
-v, --viewOpen the PR in your browser after submitting.
-w, --webOpen a web browser to edit PR metadata, even if no new PRs are being created or if configured to edit PR metadata via the CLI.

Sync all branches with remote, prompting to delete any branches for PRs that have been merged or closed. 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
-f, --forceDon't prompt for confirmation before overwriting or deleting a branch in any place where confirmation is requested.
--restackRestack any branches that can be restacked without conflicts (true by default; skip with --no-restack).

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

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.

Arguments
[branch] (optional)Branch to begin tracking. Defaults to the current branch.
Flags
-f, --forceSets the parent to the most recent tracked ancestor of the branch being tracked to skip prompts. Takes precedence over --parent
-p, --parentThe tracked branch's parent. Must be set to a tracked branch. If provided, only one branch can be tracked at a time.

Switch to the trunk branch.

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.

Arguments
[branch] (optional)Branch to stop tracking.
Flags
-f, --forceWill not prompt for confirmation before untracking a branch with children.

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

Flags
-n, --stepsThe number of levels to traverse upstack.