# git .pack expansion question

2 messages from 2007-07-12 to 2007-07-12. Participants: Ryan Moszynski, Brian Gernhardt.
Thread: https://gitlist.dev/t/9007

## Ryan Moszynski, 2007-07-12 19:03

Subject: git .pack expansion question
Message-ID: <5ed683f50707121203q52084b72o106616f1c8710141@mail.gmail.com>
URL: https://gitlist.dev/e/5ed683f50707121203q52084b72o106616f1c8710141%40mail.gmail.com

```
hopefully this is the right list for this:

am i understanding this right?

if i run the command:
git-repack
this creates an .idx and a .pack file that together hold all the files
and other metadata for my git directory.  What i can't figure out
though, is how to send just these two files to another machine over
the network, and then using only these two files, have git create a
replica of the original git directory that the .pack file was made
from.  I've tried

mkdir git-test
cd git-test
cp pack-92fadfab20e56acbbf28ed45851d61dc0d35c6ab.idx && .pack ./
git-init-db
git add .
git-unpack-objects < pack-92fadfab20e56acbbf28ed45851d61dc0d35c6ab.pack


now, the objects that were created from my original files are in the
objects directory, but I need them expanded so my git directory is a
copy of the one i originally git-repack'ed.  Is there an easy way to
do this?  This is for back up and archival purposes.

here are three ways i know to do this already, none of which I like very much.

cloning a repository over a network,
drawback: git has to be installed on both machines
or
scp'ing my whole git directory over the network,
drawback: too many little files, scp is too slow
or
tar'ing up my git directory so i can send one file for everything,
drawback: since git already has a compression/expansion tool built in,
i shouldn't have to use another to be able to do what i need.

any comments appreciated,

ryan

```

## Brian Gernhardt, 2007-07-12 20:58

Subject: Re: git .pack expansion question
Message-ID: <873AE37B-16EA-409B-A488-96DFF2581B43@silverinsanity.com>
URL: https://gitlist.dev/e/873AE37B-16EA-409B-A488-96DFF2581B43%40silverinsanity.com
In-Reply-To: <5ed683f50707121203q52084b72o106616f1c8710141@mail.gmail.com>

```

On Jul 12, 2007, at 3:03 PM, Ryan Moszynski wrote:

> hopefully this is the right list for this:
>
> am i understanding this right?
>
> if i run the command:
> git-repack
> this creates an .idx and a .pack file that together hold all the files
> and other metadata for my git directory.

You're not understanding it correctly.  The .pack files hold all the  
data from the git repository, but none of the metadata.  The .idx  
file is an index into the pack for speed and can be re-created from  
the pack itself.

What you're looking for is git-bundle (added just after v1.5.0 it  
looks like).  `git bundle create <file-name> --all` will bundle up  
all the branches from your repository.  It doesn't seem to want to  
take the tags when I do it that way, but it's definitely the right  
start.

~~ Brian

```
