git-sync-dev-submodules
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.
More from xiaojiongqian/skills-hub
patent-search-cn-us
Patent prior-art search and novelty check guidance focused on China and the United States (CNIPA, USPTO, Google Patents, WIPO). Use when asked to plan or run CN/US patent searches, draft search strategies, or produce a preliminary novelty search report.
87jina-web-fetch
Fetch webpage text with a normal HTTP request first, then automatically fall back to jina.ai proxy when direct access fails or returns login/JS-blocked content. Use when extracting content from X (Twitter) or other pages that are hard to read directly.
52git-pr-merge
>
12gh-fix-ci
Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.
9firebase-gcp-debug
Debug Firebase and Google Cloud issues (emulators, Cloud Functions v1/v2, Firestore/Auth/Storage) using `firebase` and `gcloud` CLIs. Use when investigating Firebase 部署/函数报错, emulator 启动失败, Firestore 权限/索引问题, or when you need to query GCP Cloud Logging / Cloud Run logs for Firebase-backed services.
8auto-dev
>
8