Automatically fast-forwards the default branch in all your git worktree repos when the remote has new commits.
Scans ~/code/*/ (or $CODE_DIR) for repos with active worktrees, fetches the default branch from the primary remote (an upstream remote if present, otherwise origin), and fast-forwards only if the local branch is a strict ancestor of the remote. Diverged branches (local commits not in the sync source) are always skipped. Dirty worktrees are auto-stashed with a tagged message before the reset.
git
brew install athal7/tap/git-worktree-synccurl -sL https://github.com/athal7/git-worktree-sync/releases/latest/download/git-worktree-sync -o ~/.local/bin/git-worktree-sync
chmod +x ~/.local/bin/git-worktree-sync| Variable | Default | Description |
|---|---|---|
CODE_DIR |
~/code |
Directory to scan for git repos |
git-worktree-syncRun manually or schedule via a LaunchAgent to keep all default branches current automatically.
MIT