Jan Wielemaker wrote:
[...]
% git filter-branch --subdirectory-filter packages/chr HEAD
This indeed creates a nice directory holding only the contents of
packages/chr. But, starting qgit I see that all commits, also those
that had absolutely nothing to do with this dir are still there.
The trick is to rewrite all refs, not just HEAD. I usually proceed as
follows:
cp -a repo repo.old # just to keep a backup
cd repo
git filter-branch --subdirectory-filter somedir -- --all
The --all tells it to rewrite as many refs as possible. Note that the
-- is required. Also note that refs/original/* will still point to
the old commits, so they won't "just vanish". You may want to clone
the repository or delete them manually once you are sure the
filter-branch did the right thing.
- Thomas