git-sync-dev-submodules
SKILL.md
Git Sync Dev Submodules
Overview
- Keep the flow local-first and fast: fetch once, then sync branches with
merge --ff-onlyorrebase. - Default to refreshing
func-coreafter branch sync. - After refresh, attach each selected submodule to the superproject's current branch name at the pinned commit when the superproject is on a branch.
- Use
--skip-submodulesto skip submodule refresh entirely. - Use
--dry-runto preview actions before changing git state.
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 - Submodules:
func-core
Options
--remote <name>: remote name to fetch from (defaultorigin)--dev-branch <name>: source branch to sync against (defaultdev)--submodules <list|all>: comma-separated submodule paths, orall(defaultfunc-core)--skip-submodules: do not refresh submodules--dry-run: print the plan without changing git state--help: print usage
Inspect Pinned SHA
- Current checkout:
git ls-tree HEAD func-core | awk '{print $3}' - Specific branch:
git ls-tree <branch> func-core | awk '{print $3}' - Compare pinned vs current submodule HEAD:
printf 'pinned: '; git ls-tree HEAD func-core | awk '{print $3}'; printf 'actual: '; git -C func-core rev-parse HEAD
Common Commands
# Sync only the current worktree and refresh func-core
bash "<path-to-skill>/scripts/sync-dev-to-current-branch.sh"
# Sync every worktree from a dev worktree and refresh func-core
bash "<path-to-skill>/scripts/sync-dev-worktrees.sh"
# Sync every worktree but skip submodules
bash "<path-to-skill>/scripts/sync-dev-worktrees.sh" --skip-submodules
# 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 when a submodule branch is aligned to the superproject branch name at the pinned commit.
Weekly Installs
6
Repository
xiaojiongqian/skills-hubFirst Seen
4 days ago
Security Audits
Installed on
opencode6
gemini-cli6
claude-code6
github-copilot6
codex6
kimi-cli6