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 9068379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:10:38+00:00 2026-06-16T17:10:38+00:00

I have a situation with a corrupt object in a repository. $ git push

  • 0

I have a situation with a corrupt object in a repository.

$ git push
...
fatal: loose object 95b6a826cadae849f4932a71d6735ab6ceb47cab (stored in .git/objects/95/b6a826cadae849f4932a71d6735ab6ceb47cab) is corrupt
...

And I know that this objet is a blob linked to by an old commit:

$ git fsck --full
Checking object directories: 100% (256/256), done.
broken link from  tree 27e8e7d5b94c1dad5410a8204089828a167a0eaf
            to    blob 95b6a826cadae849f4932a71d6735ab6ceb47cab 

I have done the classic steps to recover the blob from the FAQ but it seems there is no other copy of it anywhere that I can find (I am working alone and haven’t push to the remote for a while so it’s not there) so I can’t recover it.

This blob is actually the first version of a file which has been modified a lot since then. I am fine losing the information about that version of the file. So I would like just to remove it from the commit that is pointing to it. How can I do that?

  • 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-16T17:10:39+00:00Added an answer on June 16, 2026 at 5:10 pm

    OK, I figured it out myself eventually.

    Short version: I amended the commit pointing to the corrupt blob to remove it from the history.

    Long version: I thought that since I knew what the file was, and just wanted to make it disappear from the commit, then I could just amend the old commit. I didn’t really expect it to work, but eventually it did.

    I have to point out that I removed the blob in .git/objects in trying previous things, and it is possibly important into why it worked.

    First, i had to know what commit it was. For that I used the command

    git log --raw --all --full-history -- subdir/my-file
    

    I found the commit was named 966a46….

    Then I did the steps to amend it. Since it was an old commit, I used

    git rebase -- interactive 966a46^
    

    My editor came in with one line for each commit, and I changed “pick” to “edit” in front of the commit I wanted to modify.

    The command git status showed me that the file I wanted to erase was modified:

    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #       modified:   subdir/my-file
    

    I wanted to remove it from the commit, so I did rm subdir/my-file. git status then showed me:

    #       deleted:    subdir/my-file
    

    This looked promising. So I simply committed the amended commit and continued the rebase:

    git commit --all --amend
    git rebase --continue
    

    But after having rebased a few commits it failed with this error:

    error: could not apply 45c2315... did some fancy things
    fatal: unable to read 95b6a826cadae849f4932a71d6735ab6ceb47cab
    

    45c2315 was the first commit in which my file was modified after having been created. Since it didn’t find the previous version of the file, it just failed.

    git statusshowed me, among other things:

    # Unmerged paths:
    #   (use "git reset HEAD <file>..." to unstage)
    #   (use "git add/rm <file>..." as appropriate to mark resolution)
    #
    #       deleted by us:      subdir/my-file
    

    I’m actually not sure what it means, but this commit was supposed to be the first in which the file would appear, after the fix. So I didn’t want it to be deleted, but on the contrary, added to the commit! So I did

    git add subdir/my-file
    

    And surely git status showed it as a “new file”.

    Then I did git rebase --continue and everything went good, and the rebase was a success.

    git push went then smoothly instead of failing about the broken blob.

    But there were still a problem, because git fsck was still failing:

    $ git fsck --full
    Checking object directories: 100% (256/256), done.
    broken link from    tree 27e8e7d5b94c1dad5410a8204089828a167a0eaf
                  to    blob 95b6a826cadae849f4932a71d6735ab6ceb47cab
    

    And git gc failed too, when I asked him to prune everything. So I figured out the best course of action was, since I had successfully pushed before, to clone everything back in a new repository and work from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't make git push origin B. I have situation something like this _____________________________________
I have situation, where running a query that filters by an indexed column in
We have situation where say we have four engineers that are working on software
I have a situation where there is a corrupt WAV file from which I'm
I have a situation where we have several thousand image files that have become
I have situation like this: I have commited files a,b,c,d.Now i found that by
Current situation: Have a timesheet that allows the user to enter their leave, TOIL,
I have this situation where I declare inside my main class a function that
I have a situation where I intended to step away from the object oriented
I have situation where I want to extract multiple values from multiple source objects

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.