gt submit: Submit a Graphite Stack of PRs
gt submit pushes every branch in the current Graphite stack and creates or updates a GitHub PR for each one.
Graphite (gt) manages stacked branches. gt submit is the command that turns your local stack into a chain of PRs on GitHub, updating existing ones on re-run.
What it does
gt submit pushes the branches in your stack and opens a PR per branch (or updates the existing PR), wiring each PR base to the branch below it. --stack submits the whole stack; without it only the current branch and its ancestors are submitted.
Common usage
# submit the whole stack non-interactively
gt submit --stack --no-interactive
# open all as drafts
gt submit --stack --draft --no-interactiveOptions
| Flag | What it does |
|---|---|
| --stack / -s | Submit every branch in the stack, not just ancestors |
| --no-interactive | Never prompt; fail instead of asking (for CI) |
| --draft | Open new PRs as drafts |
| --publish | Mark drafts as ready |
| --update-only | Only update existing PRs, do not create new ones |
| --no-edit | Do not open an editor for titles/bodies |
In CI
Always pass --no-interactive so gt fails fast instead of prompting. gt authenticates through the GitHub token from gt auth; in CI set the token via the environment (GRAPHITE handles the GitHub PAT) rather than an interactive gt auth flow. gt still needs a valid GitHub token with repo scope to push and open PRs.
Common errors in CI
"not authenticated" or "Please authenticate with gt auth" means no Graphite/GitHub token is configured. "This action is not supported in non-interactive mode" means gt hit a prompt with --no-interactive set; provide the missing value via a flag. "failed to push" usually means the branch is behind or the token lacks write access.
Using this in CI
CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.
- uses: actions/checkout@v4
with:
fetch-depth: 0 # history, tags, and git describe all need this
- run: |
git rev-parse --is-shallow-repository # expect false
git rev-parse --abbrev-ref HEAD # prints HEAD when detached