sync-repos

Synchronize two git working trees of the same repository using fetch and fast-forward merges.

Updated May 11, 2026
One-click install
npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill sync-repos-thachrocky12345
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-repos
Source: https://github.com/thachrocky12345/local-agent-train-workstation/tree/main/.claude/skills/sync-repos
Command: npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill sync-repos-thachrocky12345

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Two separate git checkouts of the same repository (a primary Docker copy and an Infra submodule copy) drift out of sync because commits in one working tree do not appear in the other until fetched, causing confusion about which copy is current. ## Core Features & Use Cases - Sync Status Check: Compare the HEAD commits of both checkout locations for backend and frontend repos to detect divergence. - Bidirectional Sync: Pull changes from Infra to Primary or from Primary to Infra using git fetch from a local path followed by a fast-forward-only merge. - Divergence Safety: Enforce --ff-only merges so diverged copies surface an error instead of creating accidental merge commits. - Use Case: After committing changes in the ReallyGlobal-Infra submodule copy of the backend, sync those commits into the Docker-used primary copy so local containers run the latest code. ## Quick Start Sync my repos and pull the latest infra changes into the primary checkouts for both backend and frontend.

Frequently Asked Questions about sync-repos

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync two local git checkouts of the same repository?

Fetch from the other checkout's local path with git fetch <path> <branch>, then merge using git merge FETCH_HEAD --ff-only. This transfers commits between working trees without going through the remote.

How to check if two git working trees are in sync?

Run git log --oneline -1 in each checkout and compare the HEAD commit hashes. If the hashes match, both copies point to the same commit; if they differ, one copy is ahead and needs syncing.

Why does git merge --ff-only fail when syncing repositories?

A fast-forward-only merge fails when the two copies have diverged, meaning each contains commits the other lacks. Investigate the divergence with git log on both sides before merging or rebasing; never force the sync blindly.

Do commits in a git submodule appear in other clones automatically?

No. Separate working trees on the same remote and branch are independent until you fetch. After syncing a submodule copy, also commit the updated submodule pointer in the parent repository.

When should I not use fast-forward only merges for syncing?

Avoid --ff-only when the histories have intentionally diverged and you need a true merge or rebase to reconcile them. For routine one-directional syncing of linear history, --ff-only is the safe default.