Files
leo-claude-mktplace/plugins/git-flow/skills/sync-workflow.md
lmiranda 7c8a20c804 refactor: extract skills from commands across 8 plugins
Refactored commands to extract reusable skills following the
Commands → Skills separation pattern. Each command is now <50 lines
and references skill files for detailed knowledge.

Plugins refactored:
- claude-config-maintainer: 5 commands → 7 skills
- code-sentinel: 3 commands → 2 skills
- contract-validator: 5 commands → 6 skills
- data-platform: 10 commands → 6 skills
- doc-guardian: 5 commands → 6 skills (replaced nested dir)
- git-flow: 8 commands → 7 skills

Skills contain: workflows, validation rules, conventions,
reference data, tool documentation

Commands now contain: YAML frontmatter, agent assignment,
skills list, brief workflow steps, parameters

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:32:24 -05:00

2.2 KiB

Sync Workflow

Purpose

Defines push/pull patterns, rebase strategies, upstream tracking, and stale branch detection.

When to Use

  • Pushing commits in /commit-push
  • Full sync operations in /commit-sync
  • Detecting and reporting stale branches

Push Workflow

First Push (No Upstream)

git push -u origin <branch>

Sets upstream tracking for future pushes.

Subsequent Pushes

git push

Pushes to tracked upstream.

Push After Rebase

git push --force-with-lease

Safe force push - fails if remote has new commits.

Sync with Base Branch

# 1. Fetch all with prune
git fetch --all --prune

# 2. Rebase on base branch
git rebase origin/<base-branch>

# 3. Push (force if rebased)
git push --force-with-lease

Push Conflict Handling

When push fails due to diverged history:

Remote has changes not in your local branch.

Options:
1. Pull and rebase, then push (Recommended)
2. Pull and merge, then push
3. Force push (destructive - requires confirmation)
4. Cancel and review manually

Rebase Resolution

git pull --rebase origin <branch>
git push

Merge Resolution

git pull origin <branch>
git push

Stale Branch Detection

Find local branches tracking deleted remotes:

git branch -vv | grep ': gone]'

Report Format

Stale local branches (remote deleted):
  - feat/old-feature (was tracking origin/feat/old-feature)
  - fix/merged-bugfix (was tracking origin/fix/merged-bugfix)

Run /branch-cleanup to remove these branches.

Remote Pruning

Remove stale remote-tracking references:

git fetch --prune

Or fetch all remotes:

git fetch --all --prune

Sync Status Report

Sync complete:

Local:  feat/password-reset @ abc1234
Remote: origin/feat/password-reset @ abc1234
Base:   development @ xyz7890 (synced)

Your branch is up-to-date with development.
No conflicts detected.

Cleanup:
  Remote refs pruned: 2
  Stale local branches: 2 (run /branch-cleanup to remove)

Tracking Setup

Check tracking status:

git branch -vv

Set upstream:

git branch --set-upstream-to=origin/<branch> <branch>
  • skills/git-safety.md
  • skills/merge-workflow.md