Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove large file permanently for the whole team

Tags:

git

purge

Someone in my team pushed a large file to the git server and everyone in the team now has a clone of the project with the large file.

I followed the guide in http://help.github.com/removing-sensitive-data/ and it works in my local source tree as well as on the remote server. But once another person fetches the new data from the remote server, he will easily reintroduce the large file by pushing new commits to the server.

Normally a team member will do the following to share his commit with others:

git fetch origin
git rebase origin/master
git push origin

In the step of 'rebase', the old large file is reintroduced in his local commits. Of course a direct way is to demand everyone in the team to re-clone the project after I remove the large file, but not everyone would be happy to do so. I'm finding any way other than re-cloning the whole project for everyone.

Any suggestions? Thanks.

like image 889
stid.smth Avatar asked Mar 14 '11 15:03

stid.smth


1 Answers

take a look at filter-tree. You need to edit the commit that introduced the file. Once that is done, everyone can fetch. This will make non-fast-forward remote branches in their repos - each commit after removing the offending file will be different now. When they rebase their current changes on top of the new remote branches, it should not push the large object anymore.

An alternate is to do a git rebase --preserve-merges -i where you edit the offending commit.

like image 198
Adam Dymitruk Avatar answered Oct 16 '22 06:10

Adam Dymitruk