A branch from a sub-directory?

Teemu Likonen tlikonen at iki.fi
Mon Feb 16 05:24:42 GMT 2009


On 2009-02-16 11:21 (+0900), Stephen J. Turnbull wrote:

> Stefan Monnier writes:
>
>>> Is there a way to create a branch from that directory without
>>> bringing in the complete history of the previous branch but only the
>>> history of files in that subdirectory?
>
>> - reconstruct a new history via a process similar to "rebase". This
>> way you can get rid of the history part that only affects "unrelated"
>> files, but you get a new branch unrelated to the old one.
>
> This should be do-able in git with git-filter-branch.

It's very simple:

    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.



More information about the bazaar mailing list