一键导入
sync-stale-branches
Brings diverged remote branches up to date with develop — classifies, rescues unique work, then resets or deletes stale branches
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Brings diverged remote branches up to date with develop — classifies, rescues unique work, then resets or deletes stale branches
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Defines structural rules for Laravel architecture, layering, and code organization
Defines DTO structure, lifecycle, and transformation rules across the application
Defines application service structure and business orchestration boundaries
Governs safe, incremental, repository-wide development workflow with continuous validation gates
Ensures correct execution order of migrations, seeders, and tests in CI
Defines the schema-to-factory-to-seeder contract chain — NOT NULL alignment, factory/seeder ownership boundaries, and schema drift rules
| name | sync-stale-branches |
| description | Brings diverged remote branches up to date with develop — classifies, rescues unique work, then resets or deletes stale branches |
Bring old/diverged remote branches up to date with develop.
Run this periodically to keep the branch list clean and PR-able.
EXCLUDE — branches to leave untouched (space-separated, no origin/ prefix)develop mastergit fetch --prune
# All remote branches minus the exclude list
git branch -r | grep -v 'origin/HEAD' \
| sed 's|remotes/||' \
| grep -v -E '^origin/(develop|master)$'
Add any other branches to exclude to the grep pattern.
For every candidate origin/<branch>:
A — unique file count (three-dot diff from merge-base):
git diff --name-only origin/develop...origin/<branch> | wc -l
B — files ONLY in the branch (not in develop):
git diff --name-only --diff-filter=A origin/develop origin/<branch>
Classify as:
These branches were never extended beyond the old fork point.
git push origin --delete <branch>
All unique files are already captured in a feature branch we are keeping. Reset the branch to develop HEAD so it is current but carries no stale code.
git push origin origin/develop:refs/heads/<branch> --force
Rescue uncovered files before resetting.
Group uncovered files by module/domain:
Modules/Foo/… → belongs to whatever feature owns FooOn the target feature branch (must already exist and be ahead of develop):
git checkout origin/<stale-branch> -- <uncovered-file1> <uncovered-file2> ...
git add <files>
git commit -m "chore: rescue <description> from stale <stale-branch>"
git push origin HEAD --force-with-lease
If the target feature branch does not yet exist, use the feature-branch-extraction procedure to create it properly on top of develop HEAD first.
git push origin origin/develop:refs/heads/<branch> --force
# Confirm each branch is now equal to develop
for branch in <cleaned-branches>; do
ahead=$(git rev-list origin/develop..origin/$branch --count)
behind=$(git rev-list origin/$branch..origin/develop --count)
echo "$branch → ahead=$ahead behind=$behind"
done
Expected: all cleaned branches show ahead=0 behind=0.
copilot/*) are AI-generated; resetting them is safe —--diff-filter=A flag catches files the branch adds that develop lacks.git fetch --prune first so local remote-tracking refs are current.