Read Anthropic’s case study about Graphite Reviewer
Collaborate on a stack
Learn how to work on shared collaborative stacks with other Graphite users.

Learn how to work on shared collaborative stacks with other Graphite users. Stacking doesn’t have to be single-player, and it’s a great way to collaborate with teammates on a project or feature! This page talks about how to fetch remote stacks, stack on top of your co-worker’s PRs, and submit your own changes when working with others.

gt get allows you to pull your coworker's stacks from remote into your local repository to see their changes on your own machine or as a starting point for collaboration.

For example, coworker A creates and submits their branch:

Terminal
gt create my_branch -m "My changes"
gt submit

Then, coworker B pulls the branch to their machine:

Terminal
gt get my_branch

This syncs all branches that my_branch depends on (starting from the bottom of the stack). If any of the branches already exist locally and differ from the remote version, Graphite will ask to either overwrite your local changes or rebase them on top of the remote version.


Tip

gt get is also the recommended workflow for developers who work on more than one machine: submit draft PRs for your stack on one machine with gt submit and then use gt get from the other device.


To build on top of your coworker's changes run gt get on the branch you want to build on top of, make your changes, and run gt create , exactly the same way you would to create a stack on-top of your own branch. For example, to stack some analytics changes on-top of your coworker's frontend changes:

Terminal
gt get "my-coworkers-frontend-changes"
touch analytics.js
gt create -m "add-analytics"

Lastly, when you're ready to, just run gt submit to submit your new branches to Graphite.

As you and your teammates push to your shared stack, you should both periodically run:

  • gt sync to pull down any new changes the other has made to existing branches

  • gt get for each net new branch the other has made

  • gt submit to push up changes

If you encounter any conflicts during restacking, Graphite will drop you into the same conflict resolution flow that you are already familiar with from both Graphite and git.

By default, gt get will sync the full stack. If you'd like to pull down just part of a stack, you can run gt get --downstack to sync just downstack branches.

We strongly recommend that coworkers who wish to collaborate on a branch both use gt to ensure that the dependencies are managed and synced correctly as you work together.

Only branches that your coworkers have submitted with gt can be synced down to your local environment, as we rely on the Graphite submission to keep track of the dependency tree.

If you want to stack on top of your non-Graphite-using coworkers’ branches, the best way to do this is git pull and gt branch track.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2