Skip to main content

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 --include and --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 --verbose to increase to DEBUG.
  • Use --quiet to 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_bak-0.2.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_bak-0.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

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

Hashes for git_bak-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4ef75af59f7d4f8081987e26b2484636d8b24de98ed11e0a2e9a13f4d6f36b8e
MD5 dbdc9e74921f5eef0c27d651726378cc
BLAKE2b-256 3405ef010a7f40c04aadbd3cc13730b52b593b7672ec2ae23ade627628fd8f5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_bak-0.2.0.tar.gz:

Publisher: publish-to-pypi.yml on khojbjerg/git-bak

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for git_bak-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72a0b5fb933fca06790e2257ec0bdc1f4a1c2b1220b77ff2dd5edd884b8c8eb4
MD5 bf426efe0665ab087d7bff7b0c893429
BLAKE2b-256 496f34b52fae47ff91640d981bf70acbc1850ccf1c9f6378ee79d72b8115a50c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page