title: Problems with corrupt git repo
body: <p>My git repo got corrupted while running a find and replace command (See here: <a href="https://stackoverflow.com/questions/14564936/git-reset-failing-after-find-and-replace">Git reset failing after find and replace</a>). 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 :</p>
  
  <pre><code>fatal: corrupt tree sha $someSHA
  </code></pre>
  
  <p>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 </p>
  
  <pre><code>fatal: unable to read tree $someSHA
  </code></pre>
  
  <p>(The $someSHA appearing are the same). Someone could help me ?</p>
  
  <h3>Edit 1 :</h3>
  
  <p>when I run git fsck --full, I get a serie of </p>
  
  <pre><code>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!
  ...
  </code></pre>
  
  <p>then a serie of</p>
  
  <pre><code>broken link from    tree d935b909f76ea92728d71038d0a67384353e65e1
                to    blob 05b97658ebd47fee25b76d80ac76cbd07d77961d
  ...
  </code></pre>
  
  <p>and then some missing blobs...</p>
  
  <h3>Edit 2 :</h3>
  
  <p>I ran git log --raw --all --full-history -- subdir/my-file, and I get </p>
  
  <pre><code>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)
  </code></pre>
  
  <h3>Edit 3 :</h3>
  
  <p>I ran <code>git fsck --full</code>, the I get numerous lines as so </p>
  
  <pre><code>error: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack does not match index
  fatal: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack cannot be accessed
  ...
  </code></pre>
  
  <p>when running <code>git checkout</code> to another branch I got numerous messages as so : </p>
  
  <pre><code>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
  </code></pre>
  
  <h3>Edit 4 :</h3>
  
  <p>following the suggested answer, I unpacked the files and when I checked out, I got 
  some lines as so : </p>
  
  <pre><code>error: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack does not match index
  warning: packfile .git/objects/pack/pack-fbfd8042e1e96bf5ffff88f9b5a230b8f5e4d4c4.pack cannot be accesse....
  </code></pre>
  
  <p>and then a serie of lines beginning with</p>
  
  <pre><code> 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
  </code></pre>