# filter-branch --subdirectory-filter prematurely truncating history?

3 messages from 2009-03-09 to 2009-03-11. Participants: Cap Petschulat, Johannes Sixt.
Thread: https://gitlist.dev/t/18237

## Cap Petschulat, 2009-03-09 23:08

Subject: filter-branch --subdirectory-filter prematurely truncating history?
Message-ID: <loom.20090309T230424-857@post.gmane.org>
URL: https://gitlist.dev/e/loom.20090309T230424-857%40post.gmane.org

```
I'd like to spin a subdirectory of an existing git repo off in to its
own repo while preserving history. From what I've read, I should be
able to do this with a fresh clone followed by git filter-branch
--subdirectory-filter MYSUBDIR, assuming I don't care about other
branches or tags. This runs, and when it's done, I have a repo that
contains the subdir's contents as its root. So far so good.

I would expect to see the subdir's full history when I run git log,
but instead it cuts off prematurely, showing the first commit to be
some relatively recent minor change I'll call FOO. In gitk, I can see
that history prior to FOO is still around, but FOO has no parents, and
the commit before FOO has no children. In the original repo, FOO's
parent was the merge of a branch which no longer exists, if this
matters.

Am I expecting filter-branch to do something unreasonable? Is there an
easy way to reconnect the orphaned history? Am I using the wrong tool
for the job?

```

## Johannes Sixt, 2009-03-10 07:00

Subject: Re: filter-branch --subdirectory-filter prematurely truncating history?
Message-ID: <49B60FF9.9020805@viscovery.net>
URL: https://gitlist.dev/e/49B60FF9.9020805%40viscovery.net
In-Reply-To: <loom.20090309T230424-857@post.gmane.org>

```
Cap Petschulat schrieb:
> I'd like to spin a subdirectory of an existing git repo off in to its
> own repo while preserving history. From what I've read, I should be
> able to do this with a fresh clone followed by git filter-branch
> --subdirectory-filter MYSUBDIR, assuming I don't care about other
> branches or tags. This runs, and when it's done, I have a repo that
> contains the subdir's contents as its root. So far so good.
> 
> I would expect to see the subdir's full history when I run git log,
> but instead it cuts off prematurely, showing the first commit to be
> some relatively recent minor change I'll call FOO. In gitk, I can see
> that history prior to FOO is still around, but FOO has no parents, and
> the commit before FOO has no children. In the original repo, FOO's
> parent was the merge of a branch which no longer exists, if this
> matters.

A bug in this area was fixed in git v1.6.0-rc3. Which version are you using?

-- Hannes

```

## Cap Petschulat, 2009-03-11 00:37

Subject: Re: filter-branch --subdirectory-filter prematurely truncating history?
Message-ID: <loom.20090311T003412-973@post.gmane.org>
URL: https://gitlist.dev/e/loom.20090311T003412-973%40post.gmane.org
In-Reply-To: <49B60FF9.9020805@viscovery.net>

```
Johannes Sixt <j.sixt <at> viscovery.net> writes:
> A bug in this area was fixed in git v1.6.0-rc3. Which version are you using?

I was using 1.5.4.3 from Ubuntu Hardy, but I just rebuilt git from the most
recent sources and now filter-branch does what I want. Thanks for the suggestion!

```
