CodeFaster

CodeFaster

Share this post

CodeFaster
CodeFaster
Working with your git diffs

Working with your git diffs

Tyler Adams's avatar
Tyler Adams
Sep 05, 2023
∙ Paid
3

Share this post

CodeFaster
CodeFaster
Working with your git diffs
Share

diffs are annoying to work with, here’s some tricks:

Ignore whitespace

git diff -w

A recent usage of -w turned a 447 line diff into a 102 line diff, that’s 22% the size.

Thanks for reading CodeFaster! Subscribe for free to receive new posts and support my work.

Filter Diff

filterdiff is a CLI tool to…filter…diffs. It’s mostly good at including/ignoring files, less for the content of the diff

# only show diffs of tsx files
git diff | filterdiff -i '*.tsx'

diff-to-json

From the json-toolkit, it leverages unidiff. This won’t simplify the diff, but it does turn it into json so you can write custom jq scripts to parse the diff.

$ git show | diff-to-json | jq
[
  {
    "patch_info": [
      "commit 0ca9e2407271e2d7c30530427e57c5f7c58b3256\n",
      "Author: Tyler Adams <coppero1237@gmail.com>\n",
      "Date:   Sun Apr 23 01:41:33 2023 -0400\n",
      "\n",
      "    Added installation instructions for JSON Toolkit.\n",
      "\n",
      "diff --git a/README.md b/README.md\n",
      "index 2c7f586.…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Tyler Adams
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share