# Configure git to diff Bun's lockb lockfile (/docs/guides/install/git-diff-bun-lockfile)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 304 · updated: 2026-07-28 -->
Related: [Add a dependency](/docs/guides/install/add.md), [Add a development dependency](/docs/guides/install/add-dev.md), [Add an optional dependency](/docs/guides/install/add-optional.md), [Add a peer dependency](/docs/guides/install/add-peer.md), [Add a Git dependency](/docs/guides/install/add-git.md), [Add a tarball dependency](/docs/guides/install/add-tarball.md)

<Note>
  Bun v1.1.39 introduced `bun.lock`, a JSONC formatted lockfile. `bun.lock` is human-readable and git-diffable without
  configuration, at no cost to performance. In 1.2.0+ it is the default format for new projects. See [the lockfile
  docs](/pm/lockfile#text-based-lockfile).
</Note>

***

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:

```js gitattributes icon="file-code"
*.lockb binary diff=lockb
```

***

Then add the following to your local git config:

```sh terminal icon="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:

```sh terminal icon="terminal"
git config --global diff.lockb.textconv bun
git config --global diff.lockb.binary true
```

***

## How this works [#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.
