branch-sync
Skill0 starsChanged 5 months agoMITView on GitHub
Syncs the current feature branch with the team base branch (merge base into feature) before creating a PR, resolving merge conflicts safely with build/test verification. Use when preparing a branch for a PR, when asked to sync with or merge in the base/developer branch, when a PR shows conflicts, or before pushing a long-lived feature branch.
- Deletes or force-pushes
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ChenyCHENYU/Robot_Admintheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ChenyCHENYU/Robot_Admin★ 1ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository38 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-contract-validationSkill
- architecture-scannerSkill
- auto-approve-policySkill
- auto-learningSkill
- backend-patternsSkill
- browser-testSkill
- browseSkill
- build-checkSkill
- cache-refreshSkill
- codebase-explainerSkill
- coding-standardsSkill
- commit-styleSkill
- context-switchingSkill
- continuous-learningSkill
- db-preflightSkill
- env-preflightSkill
- eval-harnessSkill
- feature-completenessSkill
- file-indexSkill
- frontend-patternsSkill
- function-extractSkill
- idev-initSkill
- import-graphSkill
- lessons-learnedSkill
- post-creation-verifySkill
- pre-ship-verifySkill
- project-mapSkill
- self-reviewSkill
- session-resumeSkill
- skill-benchmarkSkill
- skilloptSkill
- smart-contextSkill
- strategic-compactSkill
- task-journalSkill
- tdd-workflowSkill
- test-coverageSkill
- test-mapSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 53
If both sides changed the same logic and the correct combination is ambiguous → stop and ask the user.
- Distinctive: line 61
Run the tests relevant to conflicted/changed files (test-map skill).
- Distinctive: line 107
NEVER force-push to recover.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Branch Sync — Merge Base Into Feature Before PR
Team workflow: everyone works on their own branch; before a PR into the base branch, merge the base branch INTO the feature branch so the PR contains everything current. The risky part is conflict resolution — do it with evidence, then prove the merge with a build.
Configuration
Base branch resolution order:
- Explicit argument from the user
.claude/idev/project-config.json→git.baseBranch- First of
developer,develop,main,masterthat exists onorigin(git ls-remote --heads origin <name>)
Strategy: git.syncStrategy in project config — merge (default) or
rebase. Never rebase unless the project config says so.
Procedure
1. Pre-flight (abort if any fails)
git branch --show-current # must NOT be the base/protected branch
git status --porcelain # must be clean
git fetch origin- On the base branch itself → stop; this skill syncs feature branches.
- Dirty tree → surface the uncommitted files to the user: commit them
(commit-style skill) or stash (
git stash push -u -m "pre-sync") per their choice — never silently stash. - Record the rollback point:
git rev-parse HEAD.
2. Merge
git merge origin/<base> --no-edit- Clean merge → go to step 4.
- Conflicts → step 3. Never
git checkout --ours/--theirswholesale.
3. Resolve conflicts (the careful part)
List them: git diff --name-only --diff-filter=U. For each file follow
${CLAUDE_PLUGIN_ROOT}/skills/branch-sync/references/conflict-resolution.md
— three-way inspection, intent analysis of both sides, special cases
(lockfiles, migrations, generated files). Core rules:
- Understand BOTH sides' intent before resolving (what was each change for?), integrate both unless they are genuinely exclusive.
- Generated/lock files: don't hand-merge — regenerate with the tool.
- If both sides changed the same logic and the correct combination is ambiguous → stop and ask the user; show both diffs and the options.
- Stage each resolved file; when all staged:
git commit --no-edit(keep the default merge message).
4. Verify the merge (mandatory)
A compiling merge can still be semantically broken (both sides "won").
- Build once (build-check skill conventions).
- Run the tests relevant to conflicted/changed files (test-map skill).
- Failures introduced by the merge → fix before declaring the sync done; failures that pre-date the sync → report, don't hide.
5. Push and report
git push origin <feature-branch> # plain push; merge never needs forceReport: base branch + commits merged in (git log --oneline <old-head>..HEAD
summary), conflicts resolved per file with one-line rationale, verification
results (actual output), and PR readiness. Include the proposed PR title
and description, generated from the commit log:
git log origin/<base>..HEAD --oneline --first-parent # commit list
git log origin/<base>..HEAD --format="%B" # full messagesPresent the PR summary:
Proposed PR: <feature> → <base>
Title: <generated title per commit-style conventions>
Description:
<bullet-point summary of changes, references to any ticket IDs>Offer to create the PR — don't create it unasked. Platform from
git.platform in project config, or detect from git remote get-url origin:
# Azure DevOps (dev.azure.com / *.visualstudio.com) — needs the azure-devops
# az extension; org/project/repo auto-detected from the git remote:
az repos pr create --source-branch <feature> --target-branch <base> \
--title "<commit-style title>" --description "<PR body per commit-style skill>"
# GitHub:
gh pr create --base <base> --title "..." --body "..."Recovery
- Mid-merge mess:
git merge --abortreturns to the pre-merge state. - Post-merge regret (not pushed):
git reset --hard <recorded-rollback-sha>— destructive; confirm with the user first. - NEVER force-push to recover; ask the user when in doubt.
Anti-patterns
- Resolving by accepting one whole side ("ours/theirs") to make the conflict markers go away — silently discards teammates' work.
- Syncing with a dirty tree, or stashing without telling the user.
- Declaring the sync done without a post-merge build/test run.
- Rebasing a shared branch when team policy is merge (rewrites pushed history → force-push → breaks teammates).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

