Since the earliest days of Graphite, we’ve heard from users that they want to collaborate on the same stack of PRs with their teammates in real-time. Stacking your own PRs is challenging enough without a tool like Graphite, so it’s no surprise that managing a collaborative stack of PRs from multiple authors is next-to-impossible with vanilla Git. We started shipping the foundations for collaborative stacks all the way back in v0.19 of the Graphite CLI, and since then we’ve iterated and refined the experience based on all the great feedback from users in our collaboration beta.
Today, we’re excited to announce that all developers using Graphite can now confidently work together with their teammates on a shared stack of PRs - simply gt get
, gt create
, and gt submit
to fetch and share changes.
Why collaborate on stacked pull requests?
Stacking your own changes is a powerful way to stay unblocked, organize your work into logical pieces, and get faster, higher-quality feedback in code review. Collaborative stacks take this to the next level - now you can build on top of a teammate’s work without blocking them from merging in their changes today.
You can even use a shared stack to divide up work on a feature across your team - so one of you can write the data model changes, another can build the backend logic, someone else can add the API endpoints, and you can get started on the front-end all at the same time.
Create your first shared stack
You can easily create shared stacks with the Graphite commands you already know and use every day:
Fetch a teammate’s PR with
gt get
. You can copy the full command from the pull request Graphite pull request page by clicking on the branch name.Then, run
gt create
to create a new branch on top of the one you fetched.Lastly, run
gt submit
to create a stacked pull request on top of your teammate’s PR.
Here’s what a shared stack looks like in Graphite - it’s just like a normal stack, but with PRs from different authors.
If your teammate pushes changes to the PR you’ve stacked on top of, the CLI will prompt you to pull in their changes with gt sync
.
How Graphite collaboration works under the hood
Behind the scenes, Graphite automatically resolves and reconciles the complex Git states needed to make collaboration possible. Think about the last time you ran git pull --rebase
and had to resolve rebase conflicts for each of your local commits. When Graphite detects you've made local changes more recently than remote changes, it will automatically rebase your local state on top of the incoming remote changes — so you don’t have to.
Getting started
To start collaborating on stacks, update your CLI to v1.3.4+ (full changelog).
After hearing so many of you ask for a better experience for collaborating on stacked pull requests, we’re so excited to release full support for shared stacks. We started Graphite to give teams Git superpowers, and we can’t wait to see what you build with them.