Command overview
Getting started
-
chezmoi doctorchecks for common problems. If you encounter something unexpected, run this first. -
chezmoi initcreates chezmoi's source directory and a git repo on a new machine.
Daily commands
-
chezmoi add $FILEadds$FILEfrom your home directory to the source directory. -
chezmoi edit $FILEopens your editor with the file in the source directory that corresponds to$FILE. -
chezmoi statusgives a quick summary of what files would change if you ranchezmoi apply. -
chezmoi diffshows the changes thatchezmoi applywould make to your home directory. -
chezmoi applyupdates your dotfiles from the source directory. -
chezmoi edit --apply $FILEis likechezmoi edit $FILEbut also runschezmoi apply $FILEafterwards. -
chezmoi cdopens a subshell in the source directory.
sequenceDiagram
participant H as home directory
participant W as working copy
participant L as local repo
participant R as remote repo
H->>W: chezmoi add $FILE
W->>W: chezmoi edit $FILE
W-->>H: chezmoi status
W-->>H: chezmoi diff
W->>H: chezmoi apply
W->>H: chezmoi edit --apply $FILE
H-->>W: chezmoi cd
Using chezmoi across multiple machines
-
chezmoi init $GITHUB_USERNAMEclones your dotfiles from GitHub into the source directory. -
chezmoi init --apply $GITHUB_USERNAMEclones your dotfiles from GitHub into the source directory and runschezmoi apply. -
chezmoi updatepulls the latest changes from your remote repo and runschezmoi apply. -
Use normal git commands to add, commit, and push changes to your remote repo.
sequenceDiagram
participant H as home directory
participant W as working copy
participant L as local repo
participant R as remote repo
R->>W: chezmoi init $GITHUB_USERNAME
R->>H: chezmoi init --apply $GITHUB_USERNAME
R->>H: chezmoi update $GITHUB_USERNAME
W->>L: git commit
L->>R: git push
Working with templates
-
chezmoi dataprints the available template data. -
chezmoi add --template $FILEadds$FILEas a template. -
chezmoi chattr +template $FILEmakes an existing file a template. -
chezmoi cat $FILEprints the target contents of$FILE, without changing$FILE. -
chezmoi execute-templateis useful for testing and debugging templates.