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

Re: index.skipHash doesn't work with split index, was Re: Bug Report

From
Jeff King <peff@peff.net>
Date
Jul 3, 2023, 19:16 UTC
Message-ID
<20230703191636.GA3546592@coredump.intra.peff.net>
In-Reply-To
<UCH8XR.AR4M4C9D538Q1@gmail.com>
[re-adding list to cc, so everybody can benefit from the answer]
On Mon, Jul 03, 2023 at 07:43:42PM +0100, Tiago d'Almeida wrote:
> Meanwhile, just a question:
> 
> How can I correct the corrupted git repos that are in my computer with
> unstaged changes?
Probably the best path forward is:
  1. Disable one or both of the problematic config options:
       git config --global core.splitIndex false
  2. Blow away the old index, and have git re-populate it from the HEAD
     commit:
       rm -f .git/index
       git reset
     Usually "git reset" would be enough here, but since we don't know
     what funny or possibly corrupted state the index file is in,
     deleting it first seems wise). Because the default for git-reset is
     "--mixed", this won't touch your working tree files at all.
  3. You should then be able to run "git status" to see any differences
     between the working tree and the fresh index (including any
     untracked ones). And now "git add", etc, should work.
-Peff
Previous: Junio C Hamano
Message 5 of 5 in “Bug Report”
  1. Tiago d'AlmeidaJun 27, 2023
  2. index.skipHash doesn't work with split index, was Re: Bug ReportJeff King, Jun 29, 2023
  3. Johannes SchindelinJul 5, 2023
  4. Junio C HamanoJul 5, 2023
  5. Jeff KingJul 3, 2023

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.