The scenario is as follows:
I have a large CVS repository that I want to convert to 14 different git repositories. cvs2git part of the process is beautiful and leads to a large repo.git repository.
For each of the 14 git repo, I clone the main repo and I run the following command:
git filter-branch -d /tmp/rep --tag-name-filter cat --prune-empty --subdirectory-filter "sub/directory" -- --all
However, before this command, I need to run another git filter-branch command for some git repositories, because I need to rewrite the commits to move the file from the directory to another. --tree-filter is the option I'm using. The following is an example of a command line that is executed:
script_tree_filter="if test -f rep/to/my/file && test -d another/rep ; then echo Moving my file ; mv rep/to/my/file another/rep; fi" git filter-branch -d /tmp/rep --tag-name-filter cat --prune-empty --tree-filter '$script_tree_filter' -- --all
At the end of the process (14500 commits: it takes about 1 hour!) I clear ref and use git gc :
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d git reflog expire --expire=now --all git gc --prune=now
In the end, I get a 1.2Go repository (which is still clearly too large), and looking at the commits, I see that many old ones are still present. They concern files and directories, which should no longer be here after the command --subdirectory-filter .
There is a gap in the commit history between unwanted and good commits, as shown in gitk --all :

I am sure that these commits are still present due to tags on some of them. If so, is it possible to remove those tags without deleting one of the good commits?
If tags are not the cause, any idea?
For more information, the contents of the refs directory (in the git repository obtained using the filter subdirectory) are empty:
$ ls -R refs/ refs/: heads original tags refs/heads: refs/original: refs refs/original/refs: heads tags refs/original/refs/heads: refs/original/refs/tags: refs/tags:
I found that the branches and tags are listed in the packed-refs file in the git repository:
d0c675d8f198ce08bb68f368b6ca83b5fea70a2b refs/tags/v03-rev-04 95c3f91a4e92e9bd11573ff4bb8ed4b61448d8f7 refs/tags/v03-rev-05
The file contains 817 tags and 219 branches.