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.
- ๐ 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
cargo install git-sync-rs# 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 300Fully 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 monitors your repository for changes and automatically syncs them:
# Basic watch mode
git-sync-rs watch /path/to/repo
# With custom debounce (wait 2 seconds after changes)
git-sync-rs watch /path/to/repo --debounce 2
# With periodic sync every 5 minutes
git-sync-rs watch /path/to/repo --interval 300
# Dry run mode (detect changes but don't sync)
git-sync-rs watch /path/to/repo --dry-runCreate 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_name = "origin"
[[repositories]]
path = "~/my-notes"
sync_new_files = true
[[repositories]]
path = "~/my-docs"
remote_name = "backup"-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 file
This tool is designed to be a drop-in replacement for git-sync-on-inotify with additional features and better performance.
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.