Inspiration
Over the course of the MLH Fellowship, all of us have faced the issue of merging stack PRs. It has been mildly annoying how the cascading commits have hampered workflow and we wanted to build a tool that can merge and rebase all of these commits on the branch/commit we desire. And hence, stack attack was born.
What it does
- PRs are big because tasks are big
- Big PRs are hard to review
- So we should all aim for small PRs.
However, it is hard to break big PRs into small PRs and manage them together. Some:
- Small PRs need to depend on each other.
- Updates to earlier PRs or the base branch will require many individual rebases of every PR in the dependency stack.
It is hard to break big PRs into small PRs and manage them together
Instead of PRs, FB uses diffs, which are essentially just PRs of a single commit. The internal Phabricator tool and IDEs have first-class support for stacked diffs, allowing diff stacks to be created, manipulated, and landed very easily. This screenshot shows what a typical diff stack would look like if it was done on GitHub.
How We built it
Using Git principles, we decided to automate this process. To do so, we needed a way to mock-run git commands on node. Nodegit helped us achieve this. Our product is a Command line application and this was designed using the ink. To integrate the cli with GitHub we used OctoKit
The stack-attack workflow is as follows:
- Open
stack-attackdirectory and setup the config file - Run
yarn cli <repo-name>on the terminal - Select the base commit of the stack
- Select the commit you want to merge this on to
- Get a cup of coffee, cuz you done son.
Challenges We ran into
- Nodegit was relatively complicated to work with and there were a lot of features which were experimental.
- Git CLI applications are a beast in themselves, we had to learn a lot of things.
Accomplishments that we are proud of
- The LANDED PRODUCT
- ink was new, we are very proud of the way the frontend turned out.
- Working with Nodegit was tough because of a lot of experimental documentation. Reading a huge codebase was exciting.
- Octokit was fun to work with, the exploration led us to learn a lot.
What We learned
- Collaboration and Separation of Concerns
- Typescript and the importance of interfaces
- Technologies : Nodegit, Octokit, Git, OctoKit
What's next for Stack Attack
Take a look at our awesome code (read: hacky code) @ https://github.com/taneliang/stack-attack
Some ideas to extend this:
- Frontend Moving the stack around, instead of just highlighting (UX)
- Backend Amending and rebasing commits to be at the correct position, instead of cherry picking


Log in or sign up for Devpost to join the conversation.