Skip to content

Improved git workflows with graphite.dev

Published:

Clouds Image

Photo by Richy Great on Unsplash

Current Landscape

Git 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:

As someone doing code reviews for my teammates:

Solution

Upon joining my most recent company, my onboarding buddy told me about how they use graphite.

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.

Clouds Image

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.