git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Recover broken git index?

From
Andreas Ericsson <ae@op5.se>
Date
May 28, 2009, 09:01 UTC
Message-ID
<4A1E52FD.6090801@op5.se>
In-Reply-To
<4A1DB700.4080705@bcm.edu>
Misha Koshelev wrote:
> Hi, I seem to have an unrecoverable git index. I have attached the
> output of git-fsck --full. There seem to be a lot of missing trees and
> blobs. Any good way to recover?
> 

Start by copying the repository somewhere safe so you don't accidentally delete things in it.

If it's really the index that's broken, a simple
  git checkout master && git reset --hard
should do the trick.
If it doesn't, it's not the index that's at fault.

Have you done history surgery on this repository (extensive rebasing or filter-branch'ing)?

Answers to the questions below really should have been in your original post. Please include them if we're to be able to understand what's going on: What OS and platform are you using? What git version are you using? How did you first notice this? What were you doing when you first noticed this? Is your repository working correctly otherwise (ie, do you only spot these errors when you run "git fsck --full")?

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Register now for Nordic Meet on Nagios, June 3-4 in Stockholm
 http://nordicmeetonnagios.op5.org/

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Misha KoshelevNext: Misha Koshelev
Message 2 of 6 in “Recover broken git index?”
  1. Misha KoshelevMay 27, 2009
  2. Andreas EricssonMay 28, 2009
  3. Misha KoshelevMay 28, 2009
  4. Linus TorvaldsMay 28, 2009
  5. Misha KoshelevMay 28, 2009
  6. Linus TorvaldsMay 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.