I have a git repository that i have packed with git repack -a -d
, this repacked all the objects into one big file. This saves space. However I want to undo this, and turn that one big pack file into all the little object files.
The reason I want to do this is to backup the git repository to a remote server. I did a backup (before repacking). Installing git on the remote server is nontrivial, so I was going to use rsync
to copy the files. However rsync is not this clever and will basically want to copy things again. If I can 'unpack' this repository, it might make it quicker to copy.
git-unpack-objects will unpack the objects, but only inside a repo that doesn't contain the pack:
Make a new, empty repo:
mkdir new-repo; cd new-repo; git init
Write the objects in:
git unpack-objects < ../old-repo/.git/objects/pack/pack-XXX.pack
Pull the necessary branches/tags in:
git pull ../old-repo
Or, if you're adventurous, you could attempt to use the objects directory in new-repo
as a replacement for the old one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With