diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-23 23:26:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-23 23:26:52 +0300 |
| commit | 006724744a943aad877a92406a5e2b4d5d12acd3 (patch) | |
| tree | ce79e6481d3a9ae38bebf3a7acd1d3a7edd520a8 /README.md | |
| parent | 125e2a2c50bcb3eaa5dfb8802c6de3b2f406b3d2 (diff) | |
Add GitHub repository creation and improve error handling
- Add --create-github-repos flag to automatically create missing GitHub repositories
- Implement GitHub API client with token support from config/env/file
- Add Codeberg API integration to sync all public repositories
- Make sync operations stop on first error for better debugging
- Support GitHub repo creation for all sync commands (--sync, --sync-all, --sync-codeberg-public)
- Add comprehensive error messages and debug logging
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fc6a4e --- /dev/null +++ b/README.md @@ -0,0 +1,115 @@ +# GitSyncer + +GitSyncer is a tool for synchronizing git repositories between multiple organizations (e.g., GitHub and Codeberg). It automatically keeps all branches in sync across different git hosting platforms. + +## Features + +- Sync repositories between multiple git organizations +- Automatic branch creation on remotes that don't have them +- Batch sync multiple repositories with a single command +- Sync all public repositories from Codeberg to other platforms +- Merge conflict detection +- Never deletes branches (only adds/updates) + +## Installation + +```bash +go build -o gitsyncer ./cmd/gitsyncer +``` + +## Configuration + +Create a `gitsyncer.json` file: + +```json +{ + "organizations": [ + { + "host": "git@codeberg.org", + "name": "yourusername" + }, + { + "host": "git@github.com", + "name": "yourusername" + } + ], + "repositories": [ + "repo1", + "repo2" + ] +} +``` + +## Usage + +### Sync a single repository +```bash +./gitsyncer --sync repo-name +``` + +### Sync all configured repositories +```bash +./gitsyncer --sync-all +``` + +### Sync all public Codeberg repositories +```bash +# Dry run - see what would be synced +./gitsyncer --sync-codeberg-public --dry-run + +# Actually sync all public repos +./gitsyncer --sync-codeberg-public +``` + +### List configured organizations +```bash +./gitsyncer --list-orgs +``` + +### List configured repositories +```bash +./gitsyncer --list-repos +``` + +### Show version +```bash +./gitsyncer --version +``` + +## How It Works + +1. GitSyncer clones the repository from the first configured organization +2. Adds all other organizations as git remotes +3. For each branch: + - Fetches from all remotes + - Merges changes from remotes that have the branch + - Pushes to all remotes (creating branches if needed) + +## Example Workflows + +### Sync specific repositories +1. Create repositories on all platforms (GitHub, Codeberg, etc.) +2. Add the repository name to your `gitsyncer.json` +3. Run `./gitsyncer --sync repo-name` +4. GitSyncer will: + - Clone from the first organization + - Push all branches to other organizations + - Keep them in sync going forward + +### Sync all public Codeberg repositories +1. Ensure Codeberg is in your organizations list +2. Run `./gitsyncer --sync-codeberg-public` +3. GitSyncer will: + - Fetch all public repositories from your Codeberg account + - Sync each one to all other configured organizations + - Skip any that fail (e.g., don't exist on other platforms) + +## Error Handling + +- **Merge conflicts**: GitSyncer will detect conflicts and exit with an error message +- **Missing repositories**: Must be created manually on all platforms +- **Missing branches**: Automatically created on remotes that don't have them + +## License + +[Add your license here]
\ No newline at end of file |
