←back to thread

1901 points l2silver | 7 comments | | HN request time: 0.651s | source | bottom

Maybe you've created your own AR program for wearables that shows the definition of a word when you highlight it IRL, or you've built a personal calendar app for your family to display on a monitor in the kitchen. Whatever it is, I'd love to hear it.
1. nhaehnle ◴[] No.35730446[source]
A tool called "diff modulo base": https://git.sr.ht/~nhaehnle/diff-modulo-base

Given two version (old and new) of a Git change (i.e., individual commit or patch series from a pull request) it produces a diff that is actually useful for reviewing purposes, assuming you've already reviewed the old version of the change.

It's sort of like `git range-diff`, but where `git range-diff` produces a "diff of diffs" that is very hard to impossible to read, this tool gives you a direct diff between old and new versions, but filters out any irrelevant changes that were introduced because the author rebased on a more recent version of the target branch.

I hope that makes sense - I never know quite how to put it into words for somebody to understand who isn't intimately familiar with Git. It is very powerful though if you combine it with a minimal amount of setup e.g. for fetching all PR branches from a GitHub repository. I use it almost daily as part of my code review workflow.

replies(6): >>35730610 #>>35739301 #>>35740724 #>>35744047 #>>35752642 #>>35758598 #
2. scubbo ◴[] No.35730610[source]
This sounds very cool! I recently moved from a FAANG company to a smaller one, and I'm _really_ missing the functionality their development tools provided (including this, which I agree is fantastic and sorely missing from the core GitHub experience).
3. PhilipRoman ◴[] No.35739301[source]
If I understand correctly, this is like normal Git three way diff except you don't need the full source of the original base?
4. noisy_boy ◴[] No.35740724[source]
Maybe you can put a small example of code changes that illustrates this. The diagram helps but actual output based on a toy example would drive it home, I think.
5. difflens ◴[] No.35744047[source]
I'm the author of DiffLens (https://www.difflens.com/). I initially built it for myself too (and use it everyday) and it's currently free for anyone to try. It's an attempt to use abstract syntax trees to make diffs more readable. Happy to see another diff project here!
6. tmoertel ◴[] No.35752642[source]
This seems very similar to the "second-order diff" trick: https://blog.moertel.com/posts/2013-02-18-git-second-order-d...
7. therealplato ◴[] No.35758598[source]
i haven't used git range-diff but when local master is behind origin/master and I am trying to diff, I use a `git changes` .gitconfig alias:

    changes = !git diff $(git merge-base HEAD \"$REVIEW_BASE\")
Typically, that's:

    git diff $(git merge-base HEAD origin/master)