git-sync-all
Original:🇺🇸 English
Translated
Recursively find all git repositories and pull latest changes from remote IN PARALLEL. Use when syncing multiple projects across machines or after switching computers.
37installs
Sourcechenxizhang/agent-skills
Added on
NPX Install
npx skill4agent add chenxizhang/agent-skills git-sync-allTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Git Sync All
Synchronize all git repositories under the current working directory by pulling latest changes from their remotes — using maximum parallelism.
When to Use
- After switching to a different computer
- When you need to update multiple projects at once
- To ensure all local repositories are up to date with remotes
Strict Execution Flow
Do NOT use any scripts. Do NOT skip or merge phases. Execute each phase in order.
Phase 1: Environment Detection (MANDATORY — must display results before proceeding)
Detect and explicitly display the following before doing anything else:
- Operating System: Run a command to detect the OS.
- Windows: or
[System.Environment]::OSVersion$env:OS - macOS/Linux:
uname -s
- Windows:
- Shell environment: Identify the current shell.
- PowerShell:
$PSVersionTable.PSVersion - bash/zsh: and
echo $SHELLorecho $BASH_VERSIONecho $ZSH_VERSION
- PowerShell:
- Agent identity: Identify which agent is running this skill (Claude Code, GitHub Copilot CLI, Cursor, etc.) based on the agent's own context/identity.
- Git availability: Run to verify git is installed.
git --version
Display the detection results clearly, for example:
Environment Detection:
OS: Windows 11 (10.0.22631)
Shell: PowerShell 7.4
Agent: GitHub Copilot CLI
Git: git version 2.44.0.windows.1All subsequent phases MUST use ONLY commands appropriate for the detected OS and shell. Never mix platform commands.
Phase 2: Plan (discover repos and generate environment-specific steps)
Step 1: Discover Repositories
Use the appropriate command for the detected environment. NOTE: directories are hidden — commands must handle hidden files/directories.
.gitFor PowerShell (Windows):
powershell
Get-ChildItem -Path <target> -Recurse -Directory -Hidden -Filter ".git" -Depth <N> -ErrorAction SilentlyContinue | ForEach-Object { $_.Parent.FullName }⚠️ CRITICAL: The flag (or ) is REQUIRED because is a hidden directory on Windows. Without it, most or all repositories will be missed.
-Hidden-Force.gitFor bash/zsh (macOS/Linux):
bash
find <target> -maxdepth <N> -type d -name ".git" 2>/dev/null | sed 's/\/.git$//'For Git Bash on Windows:
bash
find <target> -maxdepth <N> -type d -name ".git" 2>/dev/null | sed 's/\/.git$//'Default target: current working directory. Default depth: 3 levels.
Display: "Found X git repositories." followed by the list.
Step 2: Generate Parallel Execution Plan
Based on the detected agent identity, plan the parallel strategy:
| Agent | Parallel Strategy |
|---|---|
| GitHub Copilot CLI | Use multiple parallel tool calls (powershell tool) to run |
| Claude Code | Use Agent Teams / TodoWrite+TodoRead pattern to dispatch sub-agents, one per batch of repos. |
| Other agents | Use whatever parallel/concurrent execution mechanism is available. |
Display the plan before executing, e.g.:
Plan: Sync 12 repositories in parallel
Strategy: 12 parallel tool calls (GitHub Copilot CLI)
Command per repo: git -C <path> pull --ff-onlyPhase 3: Execute (parallel sync)
SYNC ALL REPOS IN PARALLEL, NOT SEQUENTIALLY!
For each repository, run in parallel:
- Check if a remote is configured:
git -C <repo> remote - If no remote → classify as "Skipped"
- If remote exists → run
git -C <repo> pull --ff-only - Classify result:
- Output contains "Already up to date" → "Up to date"
- Pull succeeded with changes → "Synced"
- Pull failed → "Failed" (capture error message)
Never sync repos one by one. The whole point of this skill is parallelism.
Phase 4: Report & Recommendations
Summary Report
=== Git Sync Summary ===
Total: N repositories
Synced: X
Up to date: Y
Skipped: Z (no remote)
Failed: W
Failed repositories:
- repo-name: error messageEnvironment-Specific Recommendations
Provide recommendations ONLY for the detected environment:
- Windows PowerShell: If repos failed due to path length, suggest enabling long paths: . Suggest
git config --system core.longpaths truefor credential management.git config --global credential.helper manager - macOS/Linux bash: If repos failed due to permissions, suggest or SSH key setup. Suggest
chmod(macOS) orgit config --global credential.helper osxkeychain(Linux).git config --global credential.helper store - NEVER recommend commands from a different platform (e.g., do NOT suggest on Windows, do NOT suggest
chmodon Linux).credential.helper manager