Improved git workflows with graphite.dev
Tags: development, git, collaboration
Published: 2022-10-02 18:25:01

---
title: Improved git workflows with graphite.dev
published: true
date: 2022-10-02 09:12:03 UTC
tags: development,git,collaboration
canonical_url: https://danielleheberling.xyz/blog/git-collaboration/
---

[![Github on a computer screen](https://danielleheberling.xyz/static/ce3322746c5771b808ef6c97fb1ed290/1c72d/github-screen.jpg "Github on a computer screen")](/static/ce3322746c5771b808ef6c97fb1ed290/857b3/github-screen.jpg)

> Photo by [Richy Great](https://unsplash.com/@richygreat?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/github?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)

## Current Landscape

[Git](https://git-scm.com/) is a tool that many tech people use. It’s great for the most part. There are some pain points that could improve the experience. My issues revolve around collaboration with others. Here’s some examples.

As someone requesting a code review, so I can merge my changes:

- waiting for someone to review my code
- merge conflicts due to a PR being open for very long
- sometimes the code in the PR is needed for next steps

As someone doing code reviews for my teammates:

- it can be unclear which PRs I need to review or re-review
- navigating very long PRs

## Solution

Upon joining my most recent company, my onboarding buddy told me about how they use [graphite](https://graphite.dev/).

Graphite utilizes something they’re calling a “stack.” What used to be one huge PR is now many branches that build off of each other with each branch being its own PR.

[![PR comment of a stack](https://danielleheberling.xyz/static/eef82e6a436a9ba558be79c5e1c4df7d/fcda8/graphite.png "PR comment of a stack")](/static/eef82e6a436a9ba558be79c5e1c4df7d/71ba4/graphite.png)

Sounds great as someone who has to review code, but as the code submitter I had some concerns about what happens when merging branches. Would I get lots of merge conflicts? So far while using graphite, the answer has been mostly no. Graphite has a cli command that pulls down changes from the upstream and automatically rebases all affected branches.

```
gt repo sync --restack
```

A nice bonus is that this command also prompts to ask if you want to delete local branches that have been merged into the `main` branch.

Another benefit is that graphite has a nice web based UI where you can see which PRs need your input both as a PR submitter and reviewer.

## Summary

Despite all of the custom cli commands, graphite uses git under the hood. If you want to do something with vanilla git, graphite will pass that command through to git directly. One con to using graphite is that it just appears to work with Github (for now?). Also, at the time of writing this, there’s a waitlist to get on the app.

There’s many more cli commands and features that I did not cover. Much like git, people have their preferred workflows and there’s many more commands/options than one would use in their daily workflow.

Disclaimer that I was not paid nor asked to write this post. I personally found this tool helpful. Thought I’d share about how it’s helped me with the intent that it might also help you.