diff command displays the differences between your target state (what chezmoi wants to apply) and the destination state (your current files) for specified targets.
Usage
Description
Thediff command shows what changes would be made by chezmoi apply without actually making those changes. If no targets are specified, it shows differences for all managed files.
If a diff.pager command is set in the configuration file, the output will be piped to it (e.g., less).
Custom Diff Commands
Ifdiff.command is set, chezmoi will invoke it to show individual file differences. Each element of diff.args is interpreted as a template with variables:
.Destination- Path to the file in the destination state.Target- Path to the file in the target state
diff.args is ["{{ .Destination }}", "{{ .Target }}"]. If diff.args doesn’t contain template arguments, these will be appended automatically.
Flags
Pager to use for output (e.g.,
less, more). Can be configured via diff.pager in the config file.Reverse the direction of the diff, i.e., show the changes to the target required to match the destination. Can be configured via
diff.reverse in the config file.Show script contents in the diff.
Exclude entry types (comma-separated:
dirs, files, remove, scripts, symlinks, always, encrypted, externals, templates).Include only specified entry types (comma-separated:
dirs, files, remove, scripts, symlinks, always, encrypted, externals, templates).Recreate the config file from the template in the source directory.
Show differences for all parent directories.
Recurse into subdirectories.
Configuration
Configure diff behavior in your config file:Examples
Show all differences
Show differences for a specific file
Use a custom pager
Show reverse diff
Diff with syntax highlighting
delta or another diff viewer.