From 5e9be3345b03e07642b12e3d6c04e8685ab293e8 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 5 May 2024 02:38:59 -0700 Subject: [PATCH] Create git-diff-bun-lockfile.md --- docs/guides/install/git-diff-bun-lockfile.md | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/guides/install/git-diff-bun-lockfile.md diff --git a/docs/guides/install/git-diff-bun-lockfile.md b/docs/guides/install/git-diff-bun-lockfile.md new file mode 100644 index 0000000000000..cf1cfc4cd99be --- /dev/null +++ b/docs/guides/install/git-diff-bun-lockfile.md @@ -0,0 +1,38 @@ +--- +name: 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: + +```js +*.lockb binary diff=lockb +``` + +--- + +Then add the following to you local git config with: + +```sh +$ git config diff.lockb.textconv bun +$ git config diff.lockb.binary true +``` + +--- + +To globally configure git to diff Bun's lockfile, add the following to your global git config with: + +```sh +$ git config --global diff.lockb.textconv bun +$ git config --global diff.lockb.binary true +``` + +--- + +## How this works + +Why 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) + +In Bun, you can execute Bun's lockfile (`bun ./bun.lockb`) to generate a human-readable version of the lockfile and `git diff` can then use that to generate a human-readable diff.