git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
CPCap Petschulat <cap@naviasystems.com>
Date
Mar 9, 2009, 23:08 UTC
Message-ID
<loom.20090309T230424-857@post.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?

Next: Johannes Sixt
Message 1 of 3 in “filter-branch --subdirectory-filter prematurely truncating history?”
  1. Cap PetschulatMar 9, 2009
  2. Johannes SixtMar 10, 2009
  3. Cap PetschulatMar 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.