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.

--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 a file.
--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.

-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.

--legacyAppend legacy aliases to your configuration. See for more details.
--resetReset your alias configuration.

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

-t, --tokenAuth token. Get it from:

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.

[branch] (optional)The branch to checkout.
-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.

-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.

[name] (optional)The name of the new branch.
-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.
-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.

[name] (optional)The name of the branch to delete. If no branch is provided, opens an interactive selector.
-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.

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

[demoName] (optional)Demo to run

Show the Graphite CLI docs.

Switch to the parent of the current branch.

-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.

[message] (optional)Positive or constructive feedback for the Graphite team! Jokes are chill too.
--print-debug-contextPrint a debug summary of your repo. Useful for creating bug report details.
--with-debug-contextInclude 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.

Set up fish tab completion.

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


If you have a stack like:

◯ call-api-from-frontend
◉ add-server-tests
◯ create-server-api
◯ main

and you want to combine the add-server-tests branch with the create-server-api branch, you would:

# Checkout the branch you want to fold into the parent
gt checkout add-server-tests

# Fold it into the parent
gt fold

You should now have a stack like this:

◯ call-api-from-frontend
◉ create-server-api
◯ main

The create-server-api branch now also contains the code that used to be in add-server-tests.

As well, the call-api-from-frontend branch will be automatically restacked on top of the updated create-server-api branch.


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

For a given branch or PR number, get branches from trunk to the given branch from remote, prompting the user to resolve conflicts. If no branch is provided, get downstack from the current branch.

[branch] (optional)Branch or PR number to get from remote.
-f, --forceOverwrite all fetched branches with remote source of truth

Read extended guides on how to use the gt program.

Display information about the current branch.

-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.

--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

--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.

[command] (optional)
--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.

-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.

-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.

-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.

[branch] (optional)A branch name or PR number to open.
--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.

[name] (optional)The new name for the current branch.
-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.

--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.

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

Split the current branch into multiple single-commit branches.

-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.

--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.

--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.
--cliSubmit via CLI.
--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.
-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-webDo not submit via browser.
-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, --webSubmit via browser. If neither --web nor --no-web is passed in, will prompt for new PRs.

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.

--deleteDelete merged branches (true by default; skip with --no-delete).
-f, --forceDon't prompt for confirmation before deleting a branch or overwriting trunk to match remote if it can't be fast-forwarded.
--pullPull the trunk branch from remote (true by default; skip with --no-pull).
--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.

[branch] (optional)Branch to begin tracking. Defaults to the current branch.
-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.

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

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

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