Skip to content

daft update

Update worktree branches from remote

Usage

daft update [OPTIONS] [TARGETS] [PULL_ARGS]

Description

Updates worktree branches from their remote tracking branches. Targets can use refspec syntax (source:destination) to update a worktree from a different remote branch.

Same-branch mode (source equals destination, or no refspec) uses git pull with configurable options (--rebase, --ff-only, --autostash, and any extra PULL_ARGS). The default pull strategy is --ff-only, configurable via git config daft.update.args.

Cross-branch mode (source differs from destination, e.g. master:test) uses git fetch + git reset --hard and ignores all pull flags. This is useful for resetting a worktree to match a different remote branch.

Worktrees with uncommitted changes are skipped unless --force is specified. Use --dry-run to preview what would be done without making changes.

Arguments

ArgumentDescriptionRequired
<TARGETS>Target worktree(s) by name or refspec (source:destination)No
<PULL_ARGS>Additional arguments to pass to git pull (same-branch mode only)No

Options

OptionDescriptionDefault
--allUpdate all worktrees
-f, --forceUpdate even with uncommitted changes
--dry-runShow what would be done
--rebaseUse git pull --rebase
--autostashUse git pull --autostash
--ff-onlyOnly fast-forward (default)
--no-ff-onlyAllow merge commits
-v, --verboseBe verbose; show detailed progress
-q, --quietSuppress non-error output

Global Options

OptionDescription
-h, --helpPrint help information
-V, --versionPrint version information

Examples

bash
# Update the current worktree from its tracking branch
daft update

# Update a specific worktree
daft update feature/auth

# Update all worktrees
daft update --all

# Update with rebase instead of merge
daft update --rebase

# Reset the test worktree to match origin/master (cross-branch)
daft update master:test

# Preview what would happen
daft update --all --dry-run

# Force update even if worktrees have uncommitted changes
daft update --all --force

See Also

Released under the MIT License.