git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Tiago d'Almeida <tjamadeira@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: index.skipHash doesn't work with split index, was Re: Bug Report
Date: Mon, 3 Jul 2023 15:16:36 -0400	[thread overview]
Message-ID: <20230703191636.GA3546592@coredump.intra.peff.net> (raw)
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

  parent reply	other threads:[~2023-07-03 19:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 16:02 Bug Report Tiago d'Almeida
2023-06-29  8:38 ` index.skipHash doesn't work with split index, was " Jeff King
     [not found]   ` <2FG8XR.63MILGOHGRJ91@gmail.com>
     [not found]     ` <UCH8XR.AR4M4C9D538Q1@gmail.com>
2023-07-03 19:16       ` Jeff King [this message]
2023-07-05 14:27   ` Johannes Schindelin
2023-07-05 17:30     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230703191636.GA3546592@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=tjamadeira@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).