Graphite vs. Git Spice
2024-11-03
Y'all know I love me some stacked diffs. I'm a full throated proponent of keeping your diffs small and stacked diffs are the easiest way I know how to do that. Sadly, I as I started my new position at Chronosphere, it meant saying good bye to Phabricator and my typical diff workflow. I needed a new tool help me stack up changes, this time with Github PRs.
Luckily, there was a tool already in use at Chronosphere: graphite. I started using it and it pretty much fit the bill exactly. It was very intuitive and worked just how I expected it to. That said, there were a few rough edges.
First, their tool is written in JavaScript and requires the installation of Node in order to run.
I'm perpetually frustrated with the whole JavaScript ecosystem and getting Node installed this time was no exception.
At first I just installed the default version of Node that Arch packages.
But this is far newer than what the graphite CLI expects.
As a result, I was getting warnings every time I ran the command because of the use of some now deprecated API.
To Graphite's credit, when I emailed them about the issue they were able to give me environment variable I could set that removed the warning.
Still, not great.
And then there was the whole issue that the frontend code at Chronosphere uses another, different version of Node for their frontend code.
At this point I was deep down the nvm
rabbit hole and not very happy.
Second, the graphite CLI tool requires an auth token in order to interact with Github. Unfortunately, this token is stored right along side the rest of the configuration that the CLI uses. I like to save my dotfiles under version control, but I couldn't do that (at least not easily) if an auth token was mixed in with the rest of the normal config.
Third, when creating a new Github PR, rather than reporting the Github URL of the new PR, the CLI instead reports some URL to a special Graphite UI. I really just wanted to be able to quickly navigate to my PR in Github, and the Graphite UI didn't really seem to provide much value. This was pretty annoying.
Fortunately, right around the same time I started at Chronosphere a buddy of mine released a new tool for creating stacked PRs: git-spice After using graphite for a month or so I decided to give git-spice a whirl. Just like graphite, I found it incredibly intuitive to use. I was up and running within minutes. But unlike Graphite, it didn't have any of the rough edges. It's written in Go1, so the resulting executable is fully self-contained. You just download a single binary file and your up and running. Auth tokens are, by default, stored in what ever keychain mechanism your OS supports so they're not mixed with any config. And lastly, it worked with regular, plain 'ol Github URLs which is exactly what I wanted.
I've been using Git Spice for a couple months now and haven't ran into any major issues. The few, small issues I have experienced have been quickly addressed by the developer. If you're looking to do small, stacked PRs I highly recommend git-spice. I'll probably make a follow-up blog post soon, showing my workflow and how to use it.
Footnotes
1 The fact it's written in Go is especially good for me. Since that's the primary language I work in, it's pretty easy for me to hack on git spice and I've even contributed a small patch.