Actually, git-unpack-objects will work just fine if you first rename or move the pack file. It's designed to add an incoming pack to a repository, adding all objects that aren't already there. Just moving the pack file to a file name where git can't find it will make all its objects unfindable.
Basically:
mv .git/objects/pack .git/objects/pack.old
for i in .git/objects/pack.old/pack-*.pack; do
git-unpack-objects
However, be aware that a pack file is much smaller than the loose objects (because loose objects don't do delta-compression against each other), and while Linus originally intended to do exactly what you're doing (loose objects only and use rsync), he quickly found that it was unworkable.
The right way to do it is to repack once (with aggressive parameters to minimize the size) and then create a .keep file (if $i
is pack-*.pack
, you want to touch ${i%pack}keep
). This will make the created pack file "sacred" and it will never be removed or repacked.
Then you can use rsync on the "leftover" pack, until it gets big enough to warrant bundling into a second .keep shunk.
A third way to do it would be to use git-bundle
to make a pack containing just the deltas since the last backup.