git-sync-manager-2-multi-phase-sync-pattern
Sub-skill of git-sync-manager: 2. Multi-Phase Sync Pattern.
Best use case
git-sync-manager-2-multi-phase-sync-pattern is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of git-sync-manager: 2. Multi-Phase Sync Pattern.
Teams using git-sync-manager-2-multi-phase-sync-pattern should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/2-multi-phase-sync-pattern/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How git-sync-manager-2-multi-phase-sync-pattern Compares
| Feature / Agent | git-sync-manager-2-multi-phase-sync-pattern | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of git-sync-manager: 2. Multi-Phase Sync Pattern.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 2. Multi-Phase Sync Pattern
## 2. Multi-Phase Sync Pattern
Execute git operations in ordered phases:
```bash
#!/bin/bash
# ABOUTME: Multi-phase git synchronization
# ABOUTME: Executes pull → commit → push in controlled phases
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
# Counters
SUCCESS=0
FAILED=0
SKIPPED=0
# ─────────────────────────────────────────────────────────────────
# Phase 1: Pull
# ─────────────────────────────────────────────────────────────────
phase_pull() {
local repos=("$@")
echo -e "${CYAN}PHASE 1: Pulling latest changes${NC}"
echo -e "${CYAN}─────────────────────────────────${NC}"
for repo in "${repos[@]}"; do
if [[ -d "$repo/.git" ]]; then
echo -n "→ Pulling $repo... "
local branch
branch=$(cd "$repo" && git rev-parse --abbrev-ref HEAD 2>/dev/null)
if (cd "$repo" && git pull origin "$branch" 2>&1 | grep -qE "Already up.to" ); then
echo -e "${GREEN}✓ (up to date)${NC}"
((SUCCESS++))
elif (cd "$repo" && git pull origin "$branch" &>/dev/null); then
echo -e "${GREEN}✓ (updated)${NC}"
((SUCCESS++))
else
echo -e "${YELLOW}⚠ (offline or error)${NC}"
((SKIPPED++))
fi
fi
done
}
# ─────────────────────────────────────────────────────────────────
# Phase 2: Commit
# ─────────────────────────────────────────────────────────────────
phase_commit() {
local repos=("$@")
local message="${COMMIT_MESSAGE:-chore: Batch synchronization}"
echo -e "\n${CYAN}PHASE 2: Staging and committing changes${NC}"
echo -e "${CYAN}───────────────────────────────────────${NC}"
for repo in "${repos[@]}"; do
if [[ -d "$repo/.git" ]]; then
# Check for changes (staged or unstaged)
local has_changes=false
if ! (cd "$repo" && git diff --quiet 2>/dev/null); then
has_changes=true
fi
if ! (cd "$repo" && git diff --cached --quiet 2>/dev/null); then
has_changes=true
fi
if [[ "$has_changes" == "true" ]]; then
echo -n "→ Committing $repo... "
if (cd "$repo" && git add -A && git commit -m "$message" --no-verify 2>/dev/null); then
echo -e "${GREEN}✓${NC}"
((SUCCESS++))
else
echo -e "${YELLOW}⊘ (commit failed)${NC}"
((SKIPPED++))
fi
else
echo -e "${YELLOW}⊘ $repo: no changes${NC}"
((SKIPPED++))
fi
fi
done
}
# ─────────────────────────────────────────────────────────────────
# Phase 3: Push
# ─────────────────────────────────────────────────────────────────
phase_push() {
local repos=("$@")
echo -e "\n${CYAN}PHASE 3: Pushing to remote${NC}"
echo -e "${CYAN}──────────────────────────${NC}"
for repo in "${repos[@]}"; do
if [[ -d "$repo/.git" ]]; then
local branch
branch=$(cd "$repo" && git rev-parse --abbrev-ref HEAD 2>/dev/null)
echo -n "→ Pushing $repo ($branch)... "
if (cd "$repo" && git push origin "$branch" 2>&1 | grep -qE "Everything up-to-date|up to date"); then
echo -e "${GREEN}✓ (up to date)${NC}"
((SUCCESS++))
elif (cd "$repo" && git push origin "$branch" &>/dev/null); then
echo -e "${GREEN}✓ (pushed)${NC}"
((SUCCESS++))
else
echo -e "${RED}✗${NC}"
((FAILED++))
fi
fi
done
}
# ─────────────────────────────────────────────────────────────────
# Full Sync
# ─────────────────────────────────────────────────────────────────
full_sync() {
local repos=("$@")
phase_pull "${repos[@]}"
phase_commit "${repos[@]}"
phase_push "${repos[@]}"
# Summary
echo ""
echo -e "${CYAN}═══════════════════════════════════════${NC}"
echo -e "${CYAN}Summary${NC}"
echo -e "${CYAN}═══════════════════════════════════════${NC}"
echo -e "Total Repos: ${#repos[@]}"
echo -e "Successful: ${GREEN}${SUCCESS}${NC}"
echo -e "Skipped: ${YELLOW}${SKIPPED}${NC}"
echo -e "Failed: ${RED}${FAILED}${NC}"
}
```Related Skills
orcaflex-reporting-fixture-proof-pattern
Build and extend fixture-backed OrcaFlex reporting proof paths in digitalmodel using stable metadata baselines, normalized HTML snapshots, and reusable reporting test helpers.
worktree-branch-sync-hygiene
Class-level branch, worktree, dirty-main, stash, sync, and hook hygiene for workspace-hub style multi-repo work.
repo-sync
Smart repository synchronization across workspace-hub ecosystem — diagnoses and fixes pull failures (detached HEAD, diverged branches, uncommitted changes)
taxact-browser-automation-patterns
Patterns for automating TaxAct Business online (Ionic SPA) via Chrome browser MCP tools — field interaction, navigation, shadow DOM handling
portable-pattern-verification-workflow
Multi-package implementation with verification strategy for cross-platform configuration hardening
portable-config-baseline-pattern
Extract machine-agnostic settings into portable template files while keeping machine-specific hooks and plugins separate
portable-baseline-pattern-implementation
Implement portable configuration baselines by separating machine-agnostic settings from machine-specific hooks and plugins
portable-baseline-pattern-extraction
Extract and separate portable baseline config from machine-specific overrides in multi-environment projects
portable-baseline-configuration-pattern
Separate portable/universal config from machine-specific settings to enable safe template reuse across environments
portable-baseline-config-pattern
Separate machine-portable baseline config from environment-specific hooks and plugins
parallel-array-alignment-pattern
Maintain index synchronization between parallel arrays when adding new entries to preserve label-path mappings
multi-year-tax-filing-verification-workflow
Verify and reconcile complex multi-form tax filings by cross-referencing source documents, identifying data dependencies, and validating line-by-line against authoritative records.