[Kde-scm-interest] Re: git filter-branch preserving history

Sitaram Chamarty sitaramc at gmail.com
Sat Nov 20 03:16:43 CET 2010


On Sat, Nov 20, 2010 at 12:31 AM, Arno Rehn <kde at arnorehn.de> wrote:

> we're currently experimenting how to best convert kdebindings to git. One
> thing that we tried was 'git filter-branch --subdirectory-filter ruby -- --
> all' to remove everything but the 'ruby' subdir and make this the top-level
> directory. The resulting directory structure looked good, but strangely the
> history of all other unrelated subdirs was left intact, even after git gc --
> aggressive and git prune.
> So the resultung repository wasn't any smaller than the original monolithic
> kdebindings thing, even though there was only a small subdir left.
>
> Is there anything to watch out for when using --subdirectory-filter? Or is it
> simply not possible to do this properly with the filter?

The last section of man git-filter-branch has some info on reducing
the size; until you do that it won't come down.  In particular, the
old refs are kept under refs/original -- you have to delete them
first.  You also have to expire out the reflogs.  Basically anything
that is still holding a reference to the old commits has to go.


More information about the Kde-scm-interest mailing list