git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Torsten Krah <krah.tm@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: Broken branch after git commit - tracked files in staging area can't be removed with restore --staged, or commit or stash
Date: Thu, 09 Jan 2020 11:49:02 +0100	[thread overview]
Message-ID: <df169ee421429f8f0aa18a897a67677a2adf2b6b.camel@gmail.com> (raw)
In-Reply-To: <20200109093931.GA299671@coredump.intra.peff.net>

Am Donnerstag, den 09.01.2020, 04:39 -0500 schrieb Jeff King:
> You should be able to do:
> 
>   git checkout your-branch
>   git reset --hard <original>
> 
> to go back to the state you were at (this is assuming you haven't
> built
> more commits on top, of course), and then repeat your steps. That
> should
> also clear out any breakage in the index, since "reset --hard" will
> invalidate the cache-tree as necessary.
> 
> If you need to find the commit id of that original commit, try
> looking
> in the reflog for your branch: git log -g your-branch

Hi Peff,

thanks that did work - but I had to "rm .git/index" before the hard
reset to get those "deleted" ones removed from the staging area, after
that I was able to use "git reset -- $files" and that was working like
expected.
Without deleting that index file I could run the hard reset but running
"git status" afterwards insisted every time on this:

On branch feature-2182
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	deleted:    docker-compose.gerrit.yml
	deleted:    docker-compose.reverseproxy.yml
	deleted:    docker-compose.yml
	deleted:    docker-seccomp.json
	deleted:    gradle.properties
	deleted:    settings.gradle

Those only vanished after deleting the index file.

The "settings.gradle" is part of my changeset and listed in the
"commit".
But those other 5 files listed I had never touched in my commit - I
don't know why they are in the staging area here - maybe some other
edge case of the git restore bug - but just a "git hard --reset $hash"
did not clear those.

Torsten
-- 



      reply	other threads:[~2020-01-09 10:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 12:55 Broken branch after git commit - tracked files in staging area can't be removed with restore --staged, or commit or stash Torsten Krah
2020-01-07 13:43 ` Torsten Krah
2020-01-07 15:28   ` Torsten Krah
2020-01-08  9:11     ` Jeff King
2020-01-08 10:02       ` Torsten Krah
2020-01-08 10:31         ` Torsten Krah
2020-01-08 10:40         ` Jeff King
2020-01-08 11:43           ` [PATCH] restore: invalidate cache-tree when removing entries with --staged Jeff King
2020-01-08 15:41             ` Junio C Hamano
2020-02-05 20:24             ` Dennis Kaarsemaker
2020-01-08 12:42           ` Broken branch after git commit - tracked files in staging area can't be removed with restore --staged, or commit or stash Torsten Krah
2020-01-09  9:39             ` Jeff King
2020-01-09 10:49               ` Torsten Krah [this message]

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

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

  git send-email \
    --in-reply-to=df169ee421429f8f0aa18a897a67677a2adf2b6b.camel@gmail.com \
    --to=krah.tm@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
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 NNTP newsgroup(s).