chezmoi is deterministic in its order of application. The order is:
- Read the source state.
- Read the destination state.
- Compute the target state.
run_before_scripts in alphabetical order.
- Update entries in the target state (files, directories, externals, scripts, symlinks, etc.) in alphabetical order of their target name. Directories (including those created by externals) are updated before the files they contain.
run_after_scripts in alphabetical order.
Target names are considered after all attributes are stripped.
modify_dot_beta in the source state,
will be updated before
.beta sorts before
chezmoi assumes that the source or destination states are not modified while chezmoi is being executed. This assumption permits significant performance improvements, including allowing chezmoi to only read files from the source and destination states if they are needed to compute the target state.
chezmoi's behavior when the above assumptions are violated is undefined. For
example, using a
run_before_ script to update files in the source or
destination states violates the assumption that the source and destination
states do not change while chezmoi is running.
External sources are updated during the update phase; it is inadvisable for
run_before_ script to depend on an external applied during the update
run_after_ scripts may freely depend on externals.