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

Re: Broken index file - any hope?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Oct 4, 2008, 03:08 UTC
Message-ID
<alpine.LFD.2.00.0810032002240.3208@nehalem.linux-foundation.org>
In-Reply-To
<48E696CB.6040405@gmx.de>
On Sat, 4 Oct 2008, Jonas Schneider wrote:
Show 6 quoted lines
> Shawn O. Pearce schrieb:
> >   git read-tree --reset HEAD
> Sadly, this doesnt help. I still get the same error.
> But, if I remove the corrupt index file, I get this:
> 
> fatal: just how do you expect me to merge 0 trees?

Sounds like you didn't recreate the whole .git directory - not only was your index file corrupt, but apparently your .git/HEAD file is too.

The index is just a cache (apart from when you stage things into it and/or do merges), and the git read-tree should have recreated it for you. The fact that it doesn't work implies that HEAD is corrupt or missing too.

Does "git branch" work for you? And what does .git/HEAD contain (normally it would just contain a single line saying "ref: refs/heads/master", but it obviously depends on which branch you were on, and it could just be a detached head that just points directly to a SHA1).

		Linus
Previous: Jeff Whiteside
Message 6 of 6 in “Broken index file - any hope?”
  1. Jonas SchneiderOct 3, 2008
  2. Shawn O. PearceOct 3, 2008
  3. Jonas SchneiderOct 3, 2008
  4. Shawn O. PearceOct 3, 2008
  5. Jeff WhitesideOct 3, 2008
  6. Linus TorvaldsOct 4, 2008

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.