Learn to create stacked pull requests with the Graphite CLI.
gt
CLI tool has 2 key purposes:
git
and pull request creation is compelling on its own! However, adding pull request stacking to your workflow levels it up even further.
Create a stack
Submit the stack
Address feedback
Merge the stack
Sync from trunk & clean up your merged branches locally
gt
should feel similar to workflows you already do with GitHub:
gt
treats stacking as a first-class concept. Stacking new PRs, addressing reviewer feedback in any part of your stack, and making sure upstack branches stay in sync with changes downstack are all seamlessly handled for you by the core gt
commands.
To stack more changes on top of an existing pull request:
gt create
to create larger and larger PR stacks.gt modify
command will let you edit any branch in a stack, and automatically restack all the branches above it.
Example: You have a stack of 2 PRs, and your coworker asks you to make changes on the bottom-most PR.
First, checkout the bottom PR and address the changes in your editor:
gt modify
to amend the last commit in this branch and restack all the branches above it:
gt modify
as well. Replace the gt modify -a
command with:
main
trunk branch will eventually get ahead of your open branches.
To update all of your open stacks with the latest changes from main
, run:
gt restack
to fix any conflicts.
main
(or whatever your trunk branch is), run gt sync
to get the latest changes in main
. In addition to fetching updates, gt sync
will:
gt sync
throughout your workflow.