All work

AI and developer tools

GitUtils: stacked branches and PR tooling

Ruby tooling I've used daily since 2021 for stacked branches, rebasing lots of branches at once, and opening and managing pull requests.

Personal project, open source · 2021 – present

The problem

I like small pull requests that build on each other. Plain git makes that painful: every change to the bottom of the stack means rebasing everything above it, and opening a pull request for each piece by hand gets old fast.

What I built

How a stack gets published

  1. Source branchone commit per change
  2. Each commitpushed to its own stack branch
  3. One PR eachbased on the one below
  4. Linkedas a GitHub stack

A sketch of the idea, not the production code.

fn stacking_diff(source_branch):
    base = main_branch()
    for commit in commits(base..source_branch):
        token = commit.label()                       # stable per change, survives rebases
        push(commit.sha, "stacks/austin/" + token, force = true)
        pr = find_or_open_pr(head = "stacks/austin/" + token, base = base)
        base = "stacks/austin/" + token              # the next PR builds on this one
    link_stack(prs)

Why it matters

It’s the tool I reach for most. Small changes are easier to review, and this makes them cheap to keep up to date.

Stack

Links