sync-branches
Use to bring every local branch and worktree across your sibling git repos up to date with origin/main in one pass — fetches, fast-forwards where safe, and reports conflicts without forcing anything. For creating a NEW worktree to isolate feature work, use /claudna:worktree instead.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-12
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- sync-branches
- description
- Use to bring every local branch and worktree across your sibling git repos up to date with origin/main in one pass — fetches, fast-forwards where safe, and reports conflicts without forcing anything. For creating a NEW worktree to isolate feature work, use /claudna:worktree instead.
- argument-hint
- [workspace-root]
- user-invocable
- true
03 SKILL.md 正文
Sync Branches
Codex: Read
../_shared/codex-tools.mdbefore following this skill. Apply its tool, root and dispatch mappings throughout.
Fetch latest origin/main and merge into all active local branches and worktrees, across every sibling repo in the workspace. Designed to run manually or on a recurring interval via /loop 2h /claudna:sync-branches.
Important: This assumes a multi-repo workspace — each sibling directory under the workspace root has its own .git. Iterate over all of them, not just the current repo.
Instructions
Step 1: Determine the workspace root
If the user names a workspace root (the [workspace-root] argument), use it. Otherwise default to the parent directory of the current repo's root:
dirname $(git rev-parse --show-toplevel)
Step 2: Discover repos
for dir in <workspace-root>/*/; do if [ -d "$dir/.git" ]; then echo "$dir"; fi; done
Step 3: For each repo — fetch, list branches, sync
git -C <repo-path> fetch origin main
git -C <repo-path> worktree list
git -C <repo-path> branch --format='%(refname:short) %(upstream:track)' | grep -v HEAD
Identify:
- The current branch in the main working tree
- All worktree branches
- Any other local branches with a remote
Step 4: Sync the main working tree
If on main:
git -C <repo-path> pull origin main
If on a feature branch, check for uncommitted changes first — never stash (a pre-existing unrelated stash entry on the stack would get silently popped into this branch):
git -C <repo-path> status --porcelain
If clean, merge:
git -C <repo-path> merge origin/main
If dirty, skip and report — same as Step 5 does for worktrees:
Skipped (uncommitted changes)
If merge fails, abort and report — do NOT force anything:
git -C <repo-path> merge --abort
Step 5: Sync each worktree
For each worktree (skip if it has uncommitted changes — just report it):
git -C <worktree-path> status --porcelain
If clean, merge:
git -C <worktree-path> merge origin/main
If merge conflicts, abort and report — do NOT force anything:
git -C <worktree-path> merge --abort
Step 6: Report
Show a summary:
| Repo | Branch | Worktree? | Status |
|---|---|---|---|
| repo-a | main | - | Up to date |
| repo-a | feature/x | /path/to/wt | Merged (3 new commits) |
| repo-b | feature/y | /path/to/wt | Skipped (uncommitted changes) |
| repo-c | feature/z | - | Conflict — needs manual merge |
If running via /loop, keep the output concise — just the table unless there are conflicts.
04 同仓库更多 Skills
example-review
Use when you want to review pull requests with detailed, actionable feedback on code quality, correctness, and maintainability.
bad-skill
Too short
worktree
Use when starting feature work that needs isolation from the current workspace, or when running multiple Claude sessions in parallel on different branches — creates and manages git worktrees. For fetching latest main into every existing worktree and branch across your sibling repos, use /claudna:sync-branches instead.
weigh-development-paths
Use when at a development junction with multiple viable approaches — architecture choices, refactoring strategies, where to put new code, or which pattern to follow. Triggers on 'which approach', 'how should I', 'Option A vs B', or any point where the next step isn't obvious and the wrong choice creates rework.
verify-completion
Use when about to claim work is complete, fixed, or passing -- requires running verification commands and confirming output before making any success claims.
vercel
Use for Vercel operations — deploy to production or preview (or roll back), view, filter, or debug deployment logs, or check project status (deployments, domains, env vars, config). Replaces /vercel-deploy, /vercel-logs, /vercel-status.