AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Sync Branch

skill-mostafa-drz-claude-skills-sync-branch · by mostafa-drz

>-

No reviews yet
0 installs
36 views
0.0% view→install

Install

$ agentstack add skill-mostafa-drz-claude-skills-sync-branch

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-mostafa-drz-claude-skills-sync-branch)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Sync Branch? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Sync Branch

Merge one branch into another, handling conflicts and preserving work in progress.

Preferences

Read ~/.claude/skills/sync-branch/preferences.md using the Read tool. If not found, no preferences are set.

Context

On startup, use Bash to detect: current git branch, git status, and remote URL (git remote get-url origin). Skip any that fail.

Command routing

Check $ARGUMENTS:

  • help → display help then stop
  • config → interactive setup then stop
  • reset → delete ~/.claude/skills/sync-branch/preferences.md, confirm, stop
  • anything else → sync branches

Flags

Parse from $ARGUMENTS:

  • --no-push — merge locally, don't push
  • --dry-run — show what would happen without executing
  • Positional args: $0 = source branch, $1 = target branch

Help

Sync Branch — Merge one branch into another

Usage:
  /sync-branch                          Merge default source into current branch
  /sync-branch                  Merge source into current branch
  /sync-branch          Merge source into target
  /sync-branch --no-push        Merge without pushing
  /sync-branch --dry-run        Preview without executing
  /sync-branch config                   Set defaults
  /sync-branch reset                    Clear preferences
  /sync-branch help                     This help

Examples:
  /sync-branch main
  /sync-branch main all-demos
  /sync-branch --dry-run main feature/auth
  /sync-branch --no-push develop

How it works:
  1. Stashes uncommitted work (if any)
  2. Updates source and target branches from remote
  3. Merges source into target
  4. Resolves conflicts (preserving both sides)
  5. Pushes target (unless --no-push)
  6. Restores original branch and stash

Current preferences:
  (shown above under Preferences)

Config

Use AskUserQuestion:

Q1 — "Default source branch?" (main (default), develop, custom) Q2 — "Auto-push after merge?" (Yes (default), No) Q3 — "Conflict resolution style?" (preserve-both (default) — keep changes from both sides, ask-each — show each conflict and ask, prefer-source — favor source branch, prefer-target — favor target branch)

Save to ~/.claude/skills/sync-branch/preferences.md.

First-time detection

If no preferences file exists, show: "First time using /sync-branch? Run /sync-branch config to set defaults, or continue — I'll merge main into your current branch."

Then proceed.

Steps

1. Resolve branches

  • Source: $0 if provided, else saved default, else main
  • Target: $1 if provided, else current branch
  • Direction: Always source → target

If source == target, error and stop.

2. Dry run check

If --dry-run:

git fetch origin
git log {target}..origin/{source} --oneline

Show what commits would be merged, then stop.

3. Stash uncommitted work

If working tree is dirty:

git stash --include-untracked

Record that a stash was created.

Record which branch the user was on originally.

4. Update source

git checkout {source}
git pull origin {source}

If pull fails → restore state, report error, stop.

5. Update and merge into target

git checkout {target}
git pull origin {target}
git merge {source} --no-edit

6. Handle conflicts

If merge reports conflicts:

  1. List conflicts: git diff --name-only --diff-filter=U
  2. Based on conflict resolution preference:
  • preserve-both: Read each file, resolve keeping both sides
  • ask-each: Show conflict to user via AskUserQuestion, let them decide
  • prefer-source/target: Auto-resolve favoring chosen side
  1. git add each resolved file
  2. git commit --no-edit

7. Push

Unless --no-push or preference says no:

git push origin {target}

8. Restore state

  1. Checkout original branch (if different from target)
  2. If stash was created: git stash pop

9. Report

Synced {source} → {target}

  {source}:  {short sha} {subject}
  {target}:  {short sha} {subject}
  Conflicts: {count} ({file list} or "none")
  Pushed:    {yes/no}

10. Learn

If user changes source branch, save preference. If user changes conflict style, save preference.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.