Back to Chezmoi

Command overview

assets/chezmoi.io/docs/user-guide/command-overview.md

2.70.22.9 KB
Original Source

Command overview

Getting started

  • chezmoi doctor checks for common problems. If you encounter something unexpected, run this first.

  • chezmoi init creates chezmoi's source directory and a git repo on a new machine.

Daily commands

  • chezmoi add $FILE adds $FILEfrom your home directory to the source directory.

  • chezmoi edit $FILE opens your editor with the file in the source directory that corresponds to $FILE.

  • chezmoi status gives a quick summary of what files would change if you ran chezmoi apply.

  • chezmoi diff shows the changes that chezmoi apply would make to your home directory.

  • chezmoi apply updates your dotfiles from the source directory.

  • chezmoi edit --apply $FILE is like chezmoi edit $FILE but also runs chezmoi apply $FILE afterwards.

  • chezmoi cd opens a subshell in the source directory.

mermaid
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

mermaid
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