sync-branch

Merges a branch's merge target into it, resolves conflicts, verifies, and pushes the result.

Updated Nov 17, 2025
One-click install
npx skills add https://github.com/vzakharov/vovazakharov.com --skill sync-branch-vzakharov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-branch
Source: https://github.com/vzakharov/vovazakharov.com/tree/main/.claude/skills/sync-branch
Command: npx skills add https://github.com/vzakharov/vovazakharov.com --skill sync-branch-vzakharov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Feature branches drift behind their PR base or the repo default branch, causing stale code, surprise conflicts at merge time, and unmergeable pull requests. This Skill brings a branch up to date with its merge target in a single, reviewable merge commit. ## Core Features & Use Cases - Target resolution via /check-merge: Detects whether the branch is contained, advanced, merged, or closed before doing any work, syncing against the PR base ref or the repo default branch as fallback. - Single merge commit with logical conflict resolution: Resolves conflicts both mechanically and semantically (keep-both, repointing callers, adopting shared abstractions), producing one merge commit whose combined diff isolates the judgment for review. - Local verification and safe push: Runs conflict-marker checks and the project's vet script before pushing, uses fast-forward-only pushes, and reports the pre-merge tip as a revert target. - Use Case: A feature branch has fallen 20 commits behind main and its PR shows conflicts. Invoke the skill to merge origin/main in, reconcile the overlapping changes, run the vet suite, and push the synced branch for review. ## Quick Start Ask the AI to sync the current branch up to its PR base by saying "sync this branch with main and resolve any conflicts".

Frequently Asked Questions about sync-branch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync a feature branch with main without rebasing?

Merge the target branch into your feature branch with git merge origin/main, resolve conflicts, and push. This preserves shared history and real commit SHAs, unlike rebase or squash which rewrite commits and sever the merge relationship.

How to resolve git merge conflicts semantically, not just textually?

Look past textual overlap to semantic collisions: keep both sides when each added distinct work, repoint callers after renames, and route through shared abstractions the target introduced. A single merge commit's combined diff then isolates exactly that judgment for review.

Can I sync a branch that has no open pull request?

Yes. When no PR exists, the merge target falls back to the repository default branch, so the branch syncs against main (or the configured default). This keeps long-lived branches a superset of the trunk.

What should I do when git push is rejected as non-fast-forward?

A non-fast-forward rejection means the branch or target moved underneath you. Re-fetch and redo the merge from the new tip rather than force-pushing; force-push is only sanctioned as an explicit operator-requested revert using --force-with-lease.

Why use one merge commit instead of separate resolution commits?

A merge commit's combined diff (git show <merge-sha>) already hides content matching either parent and shows only what differs from both, which is exactly the resolution judgment. Splitting into mechanical and resolution commits adds no review value.