git-sync
A .NET command-line tool that clones GitHub repositories locally, fast-forwards eligible branches and merges Git configuration files.
- C#
- .NET
- Git
- GitHub CLI
- Spectre.Console
Purpose and Scope
Manages local copies of multiple GitHub repositories from one command. It combines cloning missing repositories, updating branches that are behind, removing broken repository directories with confirmation, and producing merged .gitignore / .gitattributes files.
Architecture and Repository Structure
Core: options, repository states, result models and service contracts.Application:SyncOrchestrator, validators, statistics and four workflow steps.Infrastructure: Git, GitHub CLI, filesystem, process execution and Spectre.Console implementations.tests/GitSync.Tests: tests for Git behaviour, validation and workflows.
The .NET console application invokes Git and gh processes. Process execution and filesystem access sit behind interfaces.
Workflow
Startup checks required tools, GitHub authentication and the target directory. After confirmation, it runs cleanup, missing-repository cloning, updates and configuration merging in sequence.
The update step checks local changes, fetches remote references and advances eligible branches. Results appear in a terminal summary and can also be exported as JSON.
Technical Decisions
The active branch is updated with pull --ff-only. Other tracking branches are checked for ancestry before their references advance through update-ref. Diverged branches are not merged automatically.
A semaphore limits parallel cloning and updates. --dry-run previews changes; --ignore-untracked controls how untracked files affect updates. A single orchestrator orders the workflow steps.
Limits and Validation
The tool is not a general merge-conflict resolver. Local changes, detached HEAD and diverged branches limit automatic updates. It requires Git, GitHub CLI and an authenticated GitHub session.
The repository includes unit tests with mock process and filesystem implementations. This review did not run the tool or submit local repositories to its cloning/update workflow.
Sources
Reviewed on 8 September 2026. Reviewed revision (db9266b).