Last active
August 18, 2022 12:48
-
-
Save FWDekker/97d7ef4d1955a84ab8622bea6d883d23 to your computer and use it in GitHub Desktop.
How to archive a git repository (because I always forget how it works)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# See also: https://git-scm.com/docs/git-bundle | |
# Create archive | |
## Bundle the entire repository into a file named `repo.bundle` | |
git bundle create repo.bundle --all | |
# Unpack archive | |
## Unbundle the file `repo.bundle` into the directory `my_repo` | |
git clone repo.bundle my_repo | |
## (Optional) Restore the remote to the `username/repository` repo on GitHub | |
git remote set-url origin [email protected]:username/repository.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment