A Git repository backup tool written in Rust — batch clone, incremental pull, and package repositories into compressed archives.
init — Initialize configuration directory (~/.config/git-backup/) and generate a sample repository listclone — Batch clone repositories from a URL list with concurrent downloads and progress barspull — Incremental pull updates for all existing local repositoriesbackup — Full backup workflow: clone missing repos, pull updates, then pack archivespack — Package repositories into .tar.gz archives with progress indicationgit clone https://github.com/your-username/git-backup-tool.git
cd git-backup-tool
cargo build --release
./target/release/git-backup-tool --help
The project includes a .cnb.yml CI/CD pipeline that builds and releases binaries on tag push.
# 1. Initialize configuration
git-backup-tool init
# 2. Edit the repository list (default: ~/.config/git-backup/repos.txt)
# Add one Git URL per line, e.g.:
# https://github.com/rust-lang/rust.git
# https://github.com/tokio-rs/tokio.git
# 3. Clone all repositories
git-backup-tool clone
# 4. Pull latest changes
git-backup-tool pull
# 5. Package as tar.gz archives
git-backup-tool pack
# 6. Full backup (clone + pull + pack in one command)
git-backup-tool backup
Configuration file: ~/.config/git-backup/config.toml
[general]
# Backup storage directory
backup_dir = "~/.config/git-backup/backups"
[git]
# Default clone depth (0 = full history)
depth = 1
# Number of concurrent git operations
concurrency = 4
# Number of retries on failure
retries = 3
[packaging]
# Compression level (1-9)
compression_level = 6
# Output directory for packages
output_dir = "~/.config/git-backup/backups/packages"
[advanced]
# Log level: trace, debug, info, warn, error
log_level = "info"
git-backup-tool/
├── Cargo.toml
├── src/
│ ├── main.rs # CLI entry (clap derive) — 5 subcommands
│ ├── config.rs # TOML config parsing and management
│ ├── logger.rs # Logging system (tracing)
│ ├── file_io.rs # File I/O: repo list, backup records
│ ├── git_ops.rs # Git operations with retry + concurrency
│ ├── backup.rs # Backup workflow orchestration
│ └── packager.rs # tar.gz packaging module
├── docs/
│ ├── ARCHITECTURE.md
│ ├── IMPLEMENTATION_PLAN.md
│ ├── TEST_PLAN.md
│ └── ...
├── scripts/
│ ├── start.sh # Environment setup
│ ├── build.sh # Build script
│ ├── test.sh # Test runner
│ ├── release.sh # Release workflow
│ └── dev.sh # Development mode
└── .cnb.yml # CI/CD pipeline configuration
| Decision | Choice |
|---|---|
| Git backend | System git commands (not libgit2) |
| Async runtime | tokio (rt-multi-thread + sync + time) |
| Concurrency | tokio::sync::Semaphore-controlled |
| Retry strategy | Exponential backoff: 2s, 4s, 8s |
| Progress display | indicatif ProgressBar via Arc sharing |
| Configuration | Custom TOML parser (no config crate) |
| Packaging | flate2 + tar (output in packages/ subdirectory) |
| Crate | Version | Purpose |
|---|---|---|
| clap | 4.5 | CLI framework (derive) |
| tokio | 1.0 | Async runtime (minimal features) |
| serde | 1.0 | Serialization/deserialization |
| toml | 0.8 | TOML configuration parser |
| tracing | 0.1 | Logging framework |
| tracing-subscriber | 0.3 | Log output formatting |
| flate2 | 1.0 | gzip compression |
| tar | 0.4 | Tarball creation |
| indicatif | 0.17 | Progress bars |
| chrono | 0.4 | Timestamps for records |
| dirs | 5.0 | System directory paths |
| anyhow | 1.0 | Error handling |
cargo test
init, clone, pull, backup, pack)MIT