I am attempting to split a large repo into multiple smaller ones. The goal is to split a folder and retain the tags in the process.
I have tried:
git filter-branch --prune-empty --subdirectory-filter my-folder develop
This correctly place my-folder
at the root of the new project, and retained the tags. However checking out a tag resulted in seeing the entire old directory structure within the new repo.
So I tried:
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter my-folder -- --branches=develop --tags
This results in the develop branch being there with the old directory structure, BUT when I checkout a tag I see the subdirectory correctly filtered to the root! So the tags are correct but not the develop branch. Basically it has the opposite problem to the first method.
I am at a loss as to why the second method did not work. I would really appreciate any pointers!
EDIT:
Trying this now:
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter my-folder -- --all
Was hesitant as I expect that this will take quite a bit longer. This did take longer, but it mostly worked. What did not work? Well the older tags in which the folder had not yet been created were left in the repo and when checked out contained the full (very) old directory structure. I had to grep and delete all these tags. Still the repo is not as small as I wuold have expected...