Skip to content

Instantly share code, notes, and snippets.

@gerhc
Last active May 15, 2019 20:37
Show Gist options
  • Save gerhc/4eaa6df48547c46c2e683a2c258d8976 to your computer and use it in GitHub Desktop.
Save gerhc/4eaa6df48547c46c2e683a2c258d8976 to your computer and use it in GitHub Desktop.
script to clone, bundle and backup git repositories
import sh
organization = "gerhc"
repos = []
DESTINATION_FOLDER = "./repo_bundles"
for repo in repos:
print(f"Bundling {repo}")
sh.git("clone", f"git@github.com:{organization}/{repo}.git")
sh.git("bundle", "create", f"{repo}.bundle", "--all", _cwd=f"./{repo}")
sh.mv(f"./{repo}/{repo}.bundle", DESTINATION_FOLDER)
sh.rm("-rf", repo)
print(f"Finished bundling {repo}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment