Git Sync Dev Worktrees
Overview
- Keep the flow local-first and fast: fetch once, then sync branches with
merge --ff-onlyorrebase. - Use
--dry-runto preview actions before changing git state. - The skill name is unchanged for compatibility, but the workflow no longer handles submodules.
Scripts
scripts/sync-dev-to-current-branch.sh- Run in any non-detached worktree.
- If current branch is
dev, fast-forward it toorigin/dev. - Otherwise, rebase the current branch onto
origin/dev.
scripts/sync-dev-worktrees.sh- Run from a
devworktree. - Fast-forward the current
devworktree toorigin/dev. - Rebase every other clean, non-detached worktree onto local
dev.
- Run from a
Defaults
- Remote:
origin - Dev source branch:
dev
Options
--remote <name>: remote name to fetch from (defaultorigin)--dev-branch <name>: source branch to sync against (defaultdev)--dry-run: print the plan without changing git state--help: print usage
Common Commands
# Sync only the current worktree
bash "<path-to-skill>/scripts/sync-dev-to-current-branch.sh"
# Sync every worktree from a dev worktree
bash "<path-to-skill>/scripts/sync-dev-worktrees.sh"
# Preview the current-worktree sync without changing git state
bash "<path-to-skill>/scripts/sync-dev-to-current-branch.sh" --dry-run
Reporting
- Report updated worktrees.
- Report skipped detached or dirty worktrees.
- Report failures after aborting a conflicted batch rebase.
- Report current branch alignment against the target dev branch when syncing a single worktree.