Reviewing Large Changes with Jujutsu

(ben.gesoff.uk)

35 points | by bengesoff 4 days ago

3 comments

  • cube2222 1 hour ago
    A reasonably cool part about this approach (duplicating the commits, though I suppose you could just add your own bookmark on the existing commit, too) is that you can easily diff the current pr state with what you last reviewed, even across rebases, squashes, fixups, etc. Will have to give that a go.

    Unfortunately GitHub still doesn't make that easy, and branch `push --force`'s make it really hard to see what changed, would be amazing if they ever fixed that.

    In general, I think with the rise of agentic coding, and more review work, I hope we see some innovation in the "code review tooling" space. Not AI reviewers (that's useful too but already works well enough)! I want tools that help the human review code faster, more effectively, and in a more pleasant way.

    Of course can't end the comment without the obligatory "jj is great, big recommend, am not affiliated, check out the blog post I wrote a year ago for getting started with it[0]", ha! I'm still very happy with it, no going back.

    [0]: https://kubamartin.com/posts/introduction-to-the-jujutsu-vcs...

  • tensegrist 2 hours ago
    For what it's worth, I've been doing basically this with magit for years now, sometimes with the two-commit setup but usually just using the index plus top commit instead. It's not as slick, though, so this is on my list of things to try out when I give jj a spin eventually.

    `c F` in the magit menu squashes staged changes directly into a commit in the log, and `c e` amends (which is to say squashing into the tip). So in this case I'd hit `s` to stage, and either `c e` or `c F j C-c C-c` (fixup, move one item down to get to HEAD^, confirm) — both of which are practically atomic operations for me at this point.

  • pzmarzly 2 hours ago
    I haven't tested it, but this should be slightly simpler, and work better for subsequent review iterations (reviewing what changed once PR is updated):

        jj new main -m review
        jj new -m pr
        jj git fetch
        jj restore --from=big-change@origin .
    
    Then keep squashing from `pr` to `review` as described in the article. When the PR gets a new version, rerun the last 2 commands.
    • CGamesPlay 1 hour ago
      This would avoid dealing with merge conflicts when the PR changes, which is nice.