RuntimePackage ManagerBundlerTest RunnerLinterFormatterGuidesReferenceBlogFeedback

Configure git to diff Bun's lockb lockfile


To teach git how to generate a human-readable diff of Bun's binary lockfile format (.lockb), add the following to your local or global .gitattributes file:

gitattributes
*.lockb binary diff=lockb

Then add the following to your local git config:

terminal
git config diff.lockb.textconv bun
git config diff.lockb.binary true

To configure this for every repository, add the following to your global git config:

terminal
git config --global diff.lockb.textconv bun
git config --global diff.lockb.binary true

How this works

  • textconv tells git to run bun on the file before diffing
  • binary tells git to treat the file as binary (so it doesn't try to diff it line-by-line)

Running Bun on the lockfile (bun ./bun.lockb) prints a human-readable version of it, which git diff then diffs.