aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:27 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:27 +0100
commit7ef0202e2eee0feaeac3041fe2643f4d3b82ce3d (patch)
tree8c5752bcd3336e767a4f8c075c39880fb3fd8442
parent3791833e57a43c86540907da573ce354562e0600 (diff)
downloaddotfiles-7ef0202e2eee0feaeac3041fe2643f4d3b82ce3d.tar.gz
dotfiles-7ef0202e2eee0feaeac3041fe2643f4d3b82ce3d.tar.bz2
dotfiles-7ef0202e2eee0feaeac3041fe2643f4d3b82ce3d.zip
feat: add 'just diff' and 'just merge' for chezmoi drift investigation
Both accept an optional file path. 'just merge' without an argument runs chezmoi merge-all (interactive across all modified files); with an argument it merges just that one target.
-rw-r--r--.github/copilot-instructions.md2
-rw-r--r--justfile13
2 files changed, 14 insertions, 1 deletions
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 7fc90a5..1123712 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -19,7 +19,7 @@ The repo root is a chezmoi source directory. Files targeting `$HOME` use chezmoi
- `create-efi.sh` is an interactive EFI boot entry creation script using `efibootmgr`.
- `.chezmoiignore` excludes non-home files (`etc/`, `meta/`, `firefox/`, docs) from deployment to `$HOME`.
- `.githooks/` contains git hooks (notably `post-commit` which runs `chezmoi apply`). Activated by `just init`.
-- `justfile` provides recipes: `init` (first-time setup), `sync` (apply + fix), `apply`, `fix`, `status`, `groups`, `install`, `install-all`, `add`. Run `just` or `just --list` to see them.
+- `justfile` provides recipes: `init` (first-time setup), `sync` (apply + fix), `apply`, `fix`, `status`, `diff`, `merge`, `groups`, `install`, `install-all`, `add`. Run `just` or `just --list` to see them.
## Window manager
diff --git a/justfile b/justfile
index c15fbf1..fabe4f0 100644
--- a/justfile
+++ b/justfile
@@ -74,6 +74,19 @@ status:
echo "=== Dotfile drift ==="
chezmoi status -S . || true
+# Show dotfile diffs; pass a path to limit to a single file (e.g. just diff .config/nvim/init.lua)
+diff file="":
+ chezmoi diff -S . {{ file }}
+
+# Resolve dotfile conflicts with a 3-way merge; pass a path for one file, or omit to merge all
+merge file="":
+ #!/bin/sh
+ if [ -n '{{ file }}' ]; then
+ chezmoi merge -S . '{{ file }}'
+ else
+ chezmoi merge-all -S .
+ fi
+
# Show per-group install coverage; pass a group name for a per-package breakdown
groups group="":
#!/bin/sh