7 releases
| 0.7.7 | Mar 5, 2026 |
|---|---|
| 0.7.6 | Mar 5, 2026 |
| 0.7.0 | Feb 13, 2026 |
| 0.2.0 | Sep 10, 2025 |
| 0.1.5 | Aug 16, 2025 |
#1222 in Development tools
200KB
4K
SLoC
git-sync-rs
A Rust implementation of automatic git repository synchronization with file watching capabilities. This tool automatically commits, pushes, and pulls changes to keep your repositories in sync.
Features
- ๐ Automatic synchronization - Commits, fetches, pushes, and merges/rebases automatically
- ๐ File watching - Monitors file changes and triggers sync with debouncing
- ๐ซ Gitignore support - Respects
.gitignorepatterns - ๐ฆ Repository cloning - Automatically clones repositories if they don't exist
- ๐ SSH authentication - Works with SSH keys (with fallback to git command)
- โก Efficient - Only syncs when changes are detected
- ๐งช Dry-run mode - Test your configuration without making changes
- ๐ง Flexible configuration - Configure via TOML, environment variables, or CLI
Installation
cargo install git-sync-rs
Usage
Basic Commands
# Check if repository is ready to sync
git-sync-rs /path/to/repo check
# Perform one-time sync
git-sync-rs /path/to/repo sync
# Watch for changes and auto-sync
git-sync-rs /path/to/repo watch
# Watch with custom intervals
git-sync-rs /path/to/repo watch --debounce 2 --interval 300
# Print version and commit hash
git-sync-rs version
Environment Variables
Fully compatible with the original git-sync environment variables:
GIT_SYNC_DIRECTORY- Repository pathGIT_SYNC_REPOSITORY- Repository URL for initial cloneGIT_SYNC_INTERVAL- Sync interval in secondsGIT_SYNC_NEW_FILES- Whether to add new files (true/false)GIT_SYNC_REMOTE- Remote name (default: origin)GIT_SYNC_COMMIT_MESSAGE- Custom commit message template
Watch Mode
Watch mode monitors your repository for changes and automatically syncs them:
# Basic watch mode
git-sync-rs /path/to/repo watch
# With custom debounce (wait 2 seconds after changes)
git-sync-rs /path/to/repo watch --debounce 2
# With periodic sync every 5 minutes
git-sync-rs /path/to/repo watch --interval 300
# Dry run mode (detect changes but don't sync)
git-sync-rs /path/to/repo watch --dry-run
# Run watch mode for multiple repos from config
git-sync-rs watch
Configuration File
Create a configuration file at ~/.config/git-sync-rs/config.toml:
[defaults]
sync_interval = 300
sync_new_files = true
commit_message = "Auto-sync: {hostname} at {timestamp}"
remote = "origin"
[[repositories]]
path = "~/my-notes"
sync_new_files = true
watch = true
[[repositories]]
path = "~/my-docs"
remote = "backup"
watch = true
When no repository path is passed:
git-sync-rs watch(and default watch mode) runs all repositories withwatch = truein[[repositories]].- If no repo has
watch = true, watch mode runs all configured repositories. git-sync-rs checkandgit-sync-rs syncrun across all configured repositories.
Command Line Options
-n, --new-files- Sync new/untracked files-r, --remote <name>- Specify remote name-d, --directory <path>- Repository path-v, --verbose- Enable verbose output-q, --quiet- Suppress non-error output--config <path>- Use alternate config fileversion- Print semantic version and git commit hash
Compatibility
This tool is designed to be a drop-in replacement for git-sync-on-inotify with additional features and better performance.
License
Licensed under either of:
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.
Dependencies
~22โ44MB
~654K SLoC