Over a period of time the active development stops on various projects and we don't need those using our private repo slots in GitHub (which ultimately leads to hogging up $$$ for those projects). To avoid this we archive our GitHub repo and free up the paid slots from GitHub.
Step-by-Step process to create bundle of an entire Git repo, and, subsequently extracting it and transferring it to another Git repo.
With this, closed project can be archived into a single file and saved at some other location. Whenever needed it can be brought back with the entire commit history of the branches.
- Clone the repo
git clone <URL>
- Get all the branches
git remote update
git pull --all
- Here is where it get a bit manual (if I don't get some straight forward command for this then will have to write a quick script). Checkout all the branches and track them
git checkout -t origin/branch1
git checkout -t origin/branch2
.
.
.
git checkout -t origin/branchn
- Create a bundle
git bundle create proj.repo --all
- Clone the repo from the bundle
git clone proj.repo <directory name where you want to extract it>
- Checkout all the branches
git checkout -t origin/branch1
git checkout -t origin/branch2
.
.
.
git checkout -t origin/branchn
- Push to the new GitHub repo
git push <remote-alias> --all