Skip to main content
The update command pulls the latest changes from your source repository and optionally applies them to your system.

Usage

chezmoi update

Description

The update command combines pulling changes from your version control system with applying those changes to your destination directory. Default behavior:
  • If update.command is set in the config, chezmoi runs that command with update.args in the working tree
  • Otherwise, chezmoi runs git pull --autostash --rebase (with --recurse-submodules if enabled)
  • Uses chezmoi’s builtin git if useBuiltinGit is true or if git.command cannot be found in $PATH

Flags

-a, --apply
boolean
default:"true"
Apply changes after pulling. Can be disabled with --apply=false.
--recurse-submodules
boolean
default:"true"
Update submodules recursively. Can be disabled with --recurse-submodules=false. Can be configured via update.recurseSubmodules in the config file.
-x, --exclude
types
Exclude entry types (comma-separated: dirs, files, remove, scripts, symlinks, always, encrypted, externals, templates).
-i, --include
types
Include only specified entry types (comma-separated: dirs, files, remove, scripts, symlinks, always, encrypted, externals, templates).
--init
boolean
default:"false"
Recreate the config file from the template in the source directory.
-P, --parent-dirs
boolean
default:"false"
Apply changes to all parent directories.
-r, --recursive
boolean
default:"true"
Recurse into subdirectories when applying.

Configuration

You can customize the update behavior in your config file:
[update]
    command = "git"
    args = ["pull", "--rebase"]
    apply = true
    recurseSubmodules = true

Examples

Update and apply changes

chezmoi update
This is equivalent to:
cd ~/.local/share/chezmoi
git pull --autostash --rebase
chezmoi apply

Update without applying

chezmoi update --apply=false
Pulls changes but doesn’t apply them. Useful when you want to review changes first.

Update with dry run

chezmoi update --dry-run --verbose
Shows what changes would be pulled and applied without making any changes.

Update and check diff

chezmoi update --apply=false
chezmoi diff
Pull changes, review them, then apply manually if desired.

Terminal Output

$ chezmoi update
From github.com:username/dotfiles
   abc1234..def5678  main -> origin/main
Updating abc1234..def5678
Fast-forward
 .bashrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.bashrc: updating
  • init - Initialize chezmoi with a repository
  • apply - Apply changes without pulling
  • diff - View differences before applying

Build docs developers (and LLMs) love