# copying objects from another repo?

2 messages from 2007-07-24 to 2007-07-24. Participants: Michael S. Tsirkin, Johannes Schindelin.
Thread: https://gitlist.dev/t/9200

## Michael S. Tsirkin, 2007-07-24 10:35

Subject: copying objects from another repo?
Message-ID: <20070724103503.GC18701@mellanox.co.il>
URL: https://gitlist.dev/e/20070724103503.GC18701%40mellanox.co.il

```
I had some missing objects that I managed to locate
in another tree. So - how to get them to my repo?
Here's what I came up with:

cd ~/scm/good_tree
git tag -f foo dfaa7049e9ebe227cfcffc49d3de16716764bcbd
cd ~/scm/bad_tree
git fetch-pack ~/scm/good_tree dfaa7049e9ebe227cfcffc49d3de16716764bcbd

And I repeated this for all missing objects.
But is there a better way to do this?

-- 
MST

```

## Johannes Schindelin, 2007-07-24 11:14

Subject: Re: copying objects from another repo?
Message-ID: <Pine.LNX.4.64.0707241213000.14781@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0707241213000.14781%40racer.site
In-Reply-To: <20070724103503.GC18701@mellanox.co.il>

```
Hi,

On Tue, 24 Jul 2007, Michael S. Tsirkin wrote:

> I had some missing objects that I managed to locate
> in another tree. So - how to get them to my repo?
> Here's what I came up with:
> 
> cd ~/scm/good_tree
> git tag -f foo dfaa7049e9ebe227cfcffc49d3de16716764bcbd
> cd ~/scm/bad_tree
> git fetch-pack ~/scm/good_tree dfaa7049e9ebe227cfcffc49d3de16716764bcbd
> 
> And I repeated this for all missing objects.
> But is there a better way to do this?

This is what I have done in such a case:

In the valid repo:

	$ git gc
	$ scp .git/objects/packs/* the-broken:repo.git/objects/packs/

In the broken repo:

	$ git gc

Done.

Hth,
Dscho

```
