Syncs your branch with main via rebasing. Use this to stay current, resolve conflicts, and keep history clean.

Install

mkdir -p .claude/skills/repo-sync && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18823" && unzip -o skill.zip -d .claude/skills/repo-sync && rm skill.zip

Installs to .claude/skills/repo-sync

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Sync a feature branch with the default branch and resolve conflicts. Use when the branch is stale, a push is rejected, CI needs the latest main, or merging needs a conflict-free branch.
185 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Sync a feature branch with the default branch
  • Rebase onto the latest main branch
  • Resolve merge conflicts
  • Preserve the branch's intent and user changes
  • Push the rewritten branch with `git push --force-with-lease`
  • Summarize conflict files, decisions, and validation

How it works

The skill fetches and fast-forwards the current branch, then rebases it onto the main branch. It guides conflict resolution and verifies the branch history before pushing.

Inputs & outputs

You give it
A stale feature branch or a push rejection
You get back
A synchronized, conflict-free feature branch rebased onto the latest main, with a summary of resolutions

When to use repo-sync

  • Sync stale branch with main
  • Resolve merge conflicts
  • Clean up branch history before merge
  • Fetch remote updates

About this skill

Repo Sync

Goals

  • Keep the feature branch current with origin/main through rebasing.
  • Preserve the branch's intent and the user's changes.
  • Resolve conflicts by understanding both sides before editing.
  • Rerun the relevant checks after conflict resolution.
  • Never introduce a merge commit when synchronizing a feature branch.

Steps

  1. Confirm the current branch and working tree with git status --short --branch.

  2. If there are uncommitted changes, commit them with the commit skill or stop and ask how to handle them.

  3. Enable recorded conflict reuse locally:

    git config rerere.enabled true
    git config rerere.autoupdate true
    
  4. Fetch and fast-forward the current branch if the remote branch advanced:

    branch="$(git branch --show-current)"
    git fetch origin
    git pull --ff-only origin "$branch"
    
  5. Rebase onto latest main with conflict context:

    git -c merge.conflictstyle=zdiff3 rebase origin/main
    
  6. If conflicts occur:

    • Use git status, git diff --merge, and nearby code/tests/docs to understand both sides.
    • Resolve the intended behavior first, then edit.
    • Do not choose ours or theirs for a whole file unless that is clearly correct.
    • Stage each resolution and continue with GIT_EDITOR=true git rebase --continue.
    • Run git diff --check after the rebase completes.
  7. Run the relevant checks from AGENTS.md.

  8. Verify git rev-list --merges origin/main..HEAD is empty.

  9. Push the rewritten branch with git push --force-with-lease, using the previously fetched remote branch as the lease protection.

  10. Summarize conflict files, decisions, and validation in the branch notes or handoff comment.

Stop Conditions

  • The conflict depends on product intent that is not inferable from the repo, issue, or current user instructions.
  • The rebase would drop user changes or alter an external contract without clear confirmation.

When not to use it

  • When the conflict depends on product intent not inferable from the repo, issue, or instructions
  • When the rebase would drop user changes or alter an external contract without confirmation

Limitations

  • Never introduce a merge commit when synchronizing a feature branch
  • Does not choose 'ours' or 'theirs' for a whole file unless clearly correct
  • Requires understanding both sides of a conflict before editing

How it compares

This skill provides a structured process for rebasing and resolving conflicts, ensuring a clean branch history and preserving changes, unlike manual rebasing that might lead to merge commits or lost work.

Compared to similar skills

repo-sync side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
repo-sync (this skill)018dReviewIntermediate
github-manage68moReviewBeginner
tmux202moReviewIntermediate
jira116moNo flagsBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry