Git-Bak is a backup/restore cli for local Git repositories.
Project description
git-bak
git-bak is a simple CLI tool designed for automated backup and restore of local Git repositories. It allows you to easily mirror your repositories to another location and restore them when needed.
Features
- 🔄 Backup and restore local Git repositories.
- 🎯 Filter repositories using
--includeand--exclude. - 🕒 Restore from the latest or a specific timestamped backup.
- 🧾 Optional file and console logging.
- 🤫 Quiet mode for background jobs (e.g., cron).
Installation
pip install git-bak
Usage
Backup
git-bak backup --source /path/to/repos --destination /path/to/backup [options]
Restore
git-bak restore --source /path/to/backup --destination /path/to/restore [options]
Parameters
| Parameter | Description |
|---|---|
--source |
Path to the source directory (where the repos are located or backed up). |
--destination |
Path to the destination directory (where to store or restore repositories). |
--include |
(Optional) List of repository names to include. Seperate names by space. |
--exclude |
(Optional) List of repository names to exclude. Seperate names by space. |
--timestamp |
(Optional), Restore from a specific backup timestamp (e.g 20250731_1000). If not provided, restores the latest backup. |
--verbose |
(Optional) Enable debug logging. |
--log-to-file |
(Optional) Enable file logging. Log file location: $HOME/git_backup |
--quiet |
(Optional) Suppress console output (StreamHandler) (useful for cron).. |
If neither --include nor --exclude are specified, all repositories in the source directory will be backed up or restored.
Logging
- Log level defaults to
INFO. Use--verboseto increase toDEBUG. - Use
--quietto silence all console output. - File logging is disabled by default. Enable it with
--log-to-file.- Backup logs go to:
$HOME/git_backup.log - Restore logs go to:
$HOME/git_restore.log
- Backup logs go to:
Examples
Backup all repositories:
git-bak backup --source ~/projects --destination ~/git_backups
Backup only selected repositories with debug logs printed:
git-bak backup --source ~/projects --destination ~/git_backups --include repo1 repo2 --verbose
Backup all repositories quietly in a cron job:
git-bak backup --source ~/projects --destination ~/git_backups --quiet --log-to-file
Restore the latest backup of all repositories:
git-bak restore --source ~/git_backups --destination ~/restored_projects
Restore a specific backup from a timestamp:
git-bak restore --source ~/git_backups --destination ~/restored_projects --timestamp 20250731_150000
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_bak-0.2.0.tar.gz.
File metadata
- Download URL: git_bak-0.2.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ef75af59f7d4f8081987e26b2484636d8b24de98ed11e0a2e9a13f4d6f36b8e
|
|
| MD5 |
dbdc9e74921f5eef0c27d651726378cc
|
|
| BLAKE2b-256 |
3405ef010a7f40c04aadbd3cc13730b52b593b7672ec2ae23ade627628fd8f5a
|
Provenance
The following attestation bundles were made for git_bak-0.2.0.tar.gz:
Publisher:
publish-to-pypi.yml on khojbjerg/git-bak
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_bak-0.2.0.tar.gz -
Subject digest:
4ef75af59f7d4f8081987e26b2484636d8b24de98ed11e0a2e9a13f4d6f36b8e - Sigstore transparency entry: 356142275
- Sigstore integration time:
-
Permalink:
khojbjerg/git-bak@0047c34eea04b53ecc808d2bb76ecb24f81c56e2 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/khojbjerg
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@0047c34eea04b53ecc808d2bb76ecb24f81c56e2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file git_bak-0.2.0-py3-none-any.whl.
File metadata
- Download URL: git_bak-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72a0b5fb933fca06790e2257ec0bdc1f4a1c2b1220b77ff2dd5edd884b8c8eb4
|
|
| MD5 |
bf426efe0665ab087d7bff7b0c893429
|
|
| BLAKE2b-256 |
496f34b52fae47ff91640d981bf70acbc1850ccf1c9f6378ee79d72b8115a50c
|
Provenance
The following attestation bundles were made for git_bak-0.2.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on khojbjerg/git-bak
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_bak-0.2.0-py3-none-any.whl -
Subject digest:
72a0b5fb933fca06790e2257ec0bdc1f4a1c2b1220b77ff2dd5edd884b8c8eb4 - Sigstore transparency entry: 356142299
- Sigstore integration time:
-
Permalink:
khojbjerg/git-bak@0047c34eea04b53ecc808d2bb76ecb24f81c56e2 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/khojbjerg
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@0047c34eea04b53ecc808d2bb76ecb24f81c56e2 -
Trigger Event:
release
-
Statement type: