2018/04/12: Inspecting large diffs
I recently had to understand what a large commit was doing. I could
look at the diff via git show, but how to find the relevant
parts of it? diffstat -p1 gives the list of files changed,
which is already something, to see which parts of the even larger code
base are relevant. But how to easily look at the changes of individual
files?
In the end, I ended up using good old ed(1) as a viewer.
- To see all the changed files, I used g/^diff/n. Then,
to look at the changes in an individual file, I could do so
conveniently using the respective line numbers.
- To see the changes in all BUILD files, I
used g/^diff.*BUILD$/.,/^diff/-1p
(using that the last changed file in the diff wasn't a BUILD file).
- Similar for other groups of changes.
That kind-of worked. However, I can't believe that there is not a more
specialised tool for this task by now—but I couldn't find one. If you are
aware of one, please let me know.