apply command ensures that the specified targets are in the target state, updating them if necessary. This is the command that actually modifies files in your home directory to match your source state.
Usage
Description
Theapply command updates the destination directory to match the target state defined in your source directory. If no targets are specified, chezmoi applies changes to all managed files.
If a target has been modified since chezmoi last wrote it, you will be prompted to confirm whether you want to overwrite the file (unless --force is specified).
Flags
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. Useful when template data has changed.
Apply changes to all parent directories of the specified targets.
Recurse into subdirectories.
Examples
Apply all changes
Dry run to see what would change
Apply changes to a specific file
Apply with verbose output
Apply and recreate config
Behavior
Interactive Prompts
When a file has been modified locally and differs from both the target state and the last known state, chezmoi will prompt you to choose an action:- Yes - Overwrite the local file with the target state
- No - Skip this file
- All - Overwrite this and all subsequent files without prompting
- Quit - Exit chezmoi immediately
--force to automatically overwrite without prompting.
Scripts
Scripts in your source state (files starting withrun_) are executed when you apply changes. Scripts are only run once unless:
- They have the
alwaysattribute (prefixrun_always_) - You use the
--forceflag