Suppose I have had to use git filter-branch to remove a file from revision history. I want to ensure that all my collaborators update all their local copies before they push again. The obvious way to do this seems to be to use a pre-receive hook on the master repo to ensure that the original revision ID of the revision that introduced the problem file never reappears.
How do I write that hook?
I strongly support paranoia. That written, I hope your contributors would notice the "your branch has diverged" warnings or the fact their merge commits suddenly pull in hundreds of new SHA1 hashes.
Something like the following should get you most of the way there. I unfortunately cannot test it right now, but
git-receive-packandgithooks's man pages were helpful, as was this example:Searching for the file itself using pre-receive: