A branch from a sub-directory?

Teemu Likonen tlikonen at iki.fi
Mon Feb 16 08:37:25 GMT 2009


On 2009-02-16 09:18 (+0100), Gioele wrote:

> Teemu Likonen wrote:
>>     git filter-branch --subdirectory-filter <directory>
>> 
>> The resulting branch has only the files inside the subdirectory
>> <directory>. Also, the resulting branch has that directory as the
>> project's root.

> That is exactly what I need.

It seems Ian Clatworthy may be implementing the feature to "bzr
fast-import". If you want to do it immediately you can convert the
branch to Git, do the "git filter-branch" thing and convert the
resulting branch back to Bzr. More detailed steps:

Download bzr-fast-import plugin:

    bzr branch http://bazaar.launchpad.net/%7Ebzr/bzr-fastimport/fastimport.dev/

Use exporters/bzr-fast-export script and "git fast-import" for
conversion. Something like:

    (cd bzr-repo && bzr-fast-export) | (cd git-repo && git fast-import)

Then modify the Git branch with

    git filter-branch --subdirectory-filter subdir

and convert the branch back to Bzr with a command line like this:

    (cd git-repo && git fast-export -C HEAD) | (cd bzr-repo && bzr fast-import -)



More information about the bazaar mailing list