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

  • Home
  • SEARCH
  • 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 9208101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:32:36+00:00 2026-06-18T00:32:36+00:00

My git repo got corrupted while running a find and replace command (See here:

  • 0

My git repo got corrupted while running a find and replace command (See here: Git reset failing after find and replace). So I deleted some pack files about which git told me that there were not reachable. So I ran rm ./.git/index, git reset. When running git commit, I got this message :

fatal: corrupt tree sha $someSHA

Finally git fsck, my working directory went clean and I was able to commit. The pb now is that when I run git checkout some_other_branch, I got this message

fatal: unable to read tree $someSHA

(The $someSHA appearing are the same). Someone could help me ?

Edit 1 :

when I run git fsck –full, I get a serie of

error: refs/remotes/repo0/master does not point to a valid object!
error: refs/remotes/repo1/new-version does not point to a valid object!
...

then a serie of

broken link from    tree d935b909f76ea92728d71038d0a67384353e65e1
              to    blob 05b97658ebd47fee25b76d80ac76cbd07d77961d
...

and then some missing blobs…

Edit 2 :

I ran git log –raw –all –full-history — subdir/my-file, and I get

error: refs/remotes/repo0/master does not point to a valid object!
error: refs/remotes/repo1/new-version does not point to a valid object!
...
error: Could not read 9096eb9d9dcbdf15a04e0a7c78a3744936f82ac7
fatal: cannot simplify commit 8dfd8e3d5b698dc979300d93d8e89a757abf6ec6 (because of 9096eb9d9dcbdf15a04e0a7c78a3744936f82ac7)

Edit 3 :

I ran git fsck --full, the I get numerous lines as so

error: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack does not match index
fatal: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack cannot be accessed
...

when running git checkout to another branch I got numerous messages as so :

error: packfile .git/objects/pack/pack-3e7a0c040a5e3d1c21b91256d583424d82a59706.pack does not match index
warning: packfile .git/objects/pack/pack-3e7a0c040a5e3d1c21b91256d583424d82a59706.pack cannot be accessed
....
fatal: unable to read tree 2ad71d368b65eff0b6fec1ef72c6fdde6e80edad

Edit 4 :

following the suggested answer, I unpacked the files and when I checked out, I got
some lines as so :

error: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack does not match index
warning: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack cannot be accesse....

and then a serie of lines beginning with

 error: Your local changes to the following files would be overwritten by checkout:
.idea_local_work/.name
.idea_local_work/libraries/sass_stdlib.xml
.idea_local_work/scopes/scope_settings.xml
... and then aborting
  • 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-18T00:32:38+00:00Added an answer on June 18, 2026 at 12:32 am

    First: Make a backup of your .git directory in case you corrupt things more in this process. Then:

    • Put back the best version of the packfiles you have available.
    • For each of the corrupt packfiles, run:

      mv .git/objects/pack/pack-**yourpack**.pack oldpack
      git unpack-objects -r < oldpack
      
    • Run git fsck --full and git checkout again, give us the output.

    • Looks like now you should be able to check out, but you will have to run git checkout -f **yourbranch**, as you have changes in your working dir that are not yet committed. These changes will get lost when you run git checkout -f, though.

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

Sidebar

Related Questions

After pushing to a git repo, I got this error: [trusktr@starlancer bml]$ git push
I've got a git-svn checkout of my entire repo (initialized in the standard git
I've got a Git repo from which I need to create a patch file
I've got a git repo where the top level directory has three directories in
I'm setting up My First Git Repo, and on running; git config --list I've
How do I fix the path of my local git repo after move? previous
How do I create a git repo on my shared hostgator? Got SSH access
I've got a git repo, and my colleague had a clone of that on
I've got a git repo set up on my iMac and I'd like to
At this moment I've got one git repo added through gitosis. The manual i

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.