threads / discuss / 18237

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

Subject: filter-branch --subdirectory-filter prematurely truncating history?

## tl;dr

3 messages between Mar 9, 2009 and Mar 11, 2009.

replies: 2people: 2as markdown or json

Cap Petschulat· Mar 9, 2009, 23:08 UTC · lore

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· Mar 10, 2009, 07:00 UTC · re: Cap Petschulat · lore

Re: filter-branch --subdirectory-filter prematurely truncating history?

Cap Petschulat schrieb:
Show 14 quoted lines
> 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· Mar 11, 2009, 00:37 UTC · re: Johannes Sixt · lore

Re: filter-branch --subdirectory-filter prematurely truncating history?

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!

← back to recent threads