Learn how to easily create pull requests for a stack of branches with the Graphite CLI.
gt
in a repo of your choicegt submit
command allows you to submit all of the PRs in your stack at once, rather than one by one. By default it submits the current branch, and any of its ancestors (downstack branches) that need to be submitted.
To submit descendants (upstack branches as well), you can use gt submit --stack
:
submit
command you use, you’ll see interactive prompts to help you create pull requests for each branch.
gt user editor --set
(i.e. gt user editor --set vim
). By default, Graphite uses your git
editor.
For the initial state of the PR body, Graphite uses this logic:
gt config
. If you have only one commit in the PR, this will not include the title of the commit (first line of message), as this is already the default title. If you have multiple commits, all of their messages will be included. You can read more about using the CLI to customize your PR submissions on the configuration page.--reviewers
or -r
to manually specify reviewers for the new pull requests. By default, Graphite will just assign any reviewers specified by CODEOWNERS files in your repository, just like if you created the PR on GitHub.
--draft
or --publish
to specify this for all PRs in the submit without having to select each time. In --no-interactive
mode, new PRs default to draft, and existing PRs remain in the same state.
gt ss -np
for simpler changes, writing PR descriptions on the web app, or just to maximize velocity. This is the short form of gt submit --stack --no-edit --publish
.submit
again..github/
directory.docs/
directorypull_request_template
(case-insensitive) with either a .md
or .txt
file extension. If one of these is provided, GitHub autofills the body field on the PR creation page—unless it is overridden with a template query param.
If you have multiple PR templates, you can put them in a PULL_REQUEST_TEMPLATE
directory in one of the PR locations above. However, at PR creation time, GitHub doesn’t autofill the body field on the PR creation page unless you tell it which template to use through a URL query param.
On the Graphite side, if the submit
command finds multiple PR templates, it will prompt you to select one.
gt submit
is also the command for updating your PRs after making changes to your stack. For example, you might open your PRs initially in draft mode, and then later run gt submit --publish
to set your PRs to the “ready for review” state. Similarly, you can run a submit
command to update already open PRs after you’ve made new changes.
gt submit --update-only
or gt s -u
.