Five years ago Niklas asked this quite similar question - I'll give it another try with different wording.
I want to migrate an existing Subversion repository to git and use the chance to get rid of all history that doesn't affect my current trunk
/master
HEAD before I share it with my colleagues (all other history should stay intact of course).
My idea was to first git svn clone
the repository (without the branches intentionally):
git svn clone http://my/old/svn/repo/trunk new-git-repo
.. and then to remove all files I don't need any more with some magic like this:
for f in $(all_deleted_files)
do
git filter-branch --tree-filter 'rm -f ${f}' HEAD
done
Of course the big question is now: how do I get all_deleted_files
?
I could write a nice Python script and collect all files in all commits and subtract those which still exist on HEAD. But is this the only possible way?
Has someone done this before and wants to impress me with his/her script?
With a different (Subversion specific) approach - might it possible to not clone files which later got deleted anyway in the first place?