Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:11:32+00:00 2026-06-07T10:11:32+00:00

Suppose I have had to use git filter-branch to remove a file from revision

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:11:35+00:00Added an answer on June 7, 2026 at 10:11 am

    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-pack and githooks‘s man pages were helpful, as was this example:

    #!/bin/sh
    while read oldrev newrev refname
    do
        git rev-list ^$oldrev $newrev | grep "<problem-hash>"
        if test $? = 0; then
            echo "Problematic hash found. Please contact the maintainer."
            exit 1
        fi
    done
    

    Searching for the file itself using pre-receive:

    #!/bin/sh
    while read oldrev newrev refname
    do
        git diff $oldrev $newrev --name-only | grep "<full_file_path>"
        if test $? = 0; then
            echo "Problematic hash found. Please contact the maintainer."
            exit 1
        fi
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I had a WCF service that I have coded up, like Clemens Vasters's
Suppose I have a class Baz that inherits from classes Foo and Bar ,
Say I have a higher kinded type SuperMap[Key[_],Value[_]]`. Suppose now that I had something
Suppose I have a pure virtual method in the base interface that returns to
Suppose I have a static method of my class that returns an object of
Suppose I have a process that is updating a record and encounters a record
I use git for my source management, I have a local repository on my
Suppose that we have the following partial ER diagram: Notice that the attachments table
I have to pass a string to a form. I want to use a
Basically, suppose that I have a fingerprint. I know the dimension of my image,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.