I am on github. I set up a .gitignore file in which I specify files not to be added to future commits since I'm trying to lighten the cloning. Now I need to delete all those .class files for example from all the previous commits to share only the necessary sources, otherwise no matter my efforts it will always weight 50mb more or less. I had a look on http://cheat.errtheblog.com/s/git I think I might need a composition of those command but I really don't wanna s***w up my work. thanks
+4
A:
There is an example in the git-filter-branch docs which matches your use case.
git clone project project.tmp
cd project.tmp
git filter-branch --prune-empty --index-filter 'git rm --cached --ignore-unmatch *.class' HEAD
cd ..
git clone project.tmp project.clean
rm -rf project.tmp
cd project.clean
project.clean
should then be ready to be pushed upstream.
PS. If you are nervous about how this operation might go, it never hurts to experiment on a clone and github test branch.
unutbu
2010-10-14 12:18:13