First, add a diff type called “sqlite3” to your config. The simplest way is to just run these commands:

git config diff.sqlite3.binary true git config diff.sqlite3.textconv "echo .dump | sqlite3"

Alternatively, you can add this snippet to your ~/.gitconfig or .git/config in your repository:

[diff "sqlite3"] binary = true textconv = "echo .dump | sqlite3"

Next, create a file called .gitattributes if it’s not already present and add this line:

*.sqlite diff=sqlite3

Note that the filename (*.sqlite) may differ from your setup. In my case for example, it should match files with *.gnucash.

And that’s about it! The next time you run git diff or any other command that produces a diff on a sqlite file, you’ll see a nicely formatted diff of the changes.