git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Broken branch after git commit - tracked files in staging area can't be removed with restore --staged, or commit or stash
@ 2020-01-07 12:55 Torsten Krah
  2020-01-07 13:43 ` Torsten Krah
  0 siblings, 1 reply; 13+ messages in thread
From: Torsten Krah @ 2020-01-07 12:55 UTC (permalink / raw)
  To: git

Hi,

as written here https://git-scm.com/community I should sent reports to
this list - if I am mistaken please tell me where to direct this
question / problem I've encountered.

I've got a problem with a git branch and as this is the second time now
(I never hit that problem before I've started using the "new" git
restore --staged command - but since I am using it its the second time
now - maybe by accident, maybe related - I don't know).

Maybe someone can help me with this matter.

I am using 2.24.1 git and my starting point was a local branch and I
wanted to removed some files from the last commit I made.
So I did this:

1. git reset --soft HEAD~1

Now I had all my files from the last commit in the staging area and to
remove some of them I did:

2. git restore --staged $my-files

This worked too - now those files were moved to the working tree in git
status and were untracked and the rest looked still fine in the staging
area.

3. git commit

Now I made my commit - had a look on that with git show and it looks
fine.

But now I've hit the problem - looking with "git status" I was left now
with 6 files in the staging area all marked as deleted - still they are
in the working tree.
But I did never deleted them and the most annoying part now - I can't
fix that.

I tried:

1. git restore --staged

Does not change anything, still deleted in the staging area.

2. git stash

Does create a stash entry (did not look at the content though yet) but
staging area still unchanged.

3. git commit

Does create a commit but the whole commit is empty - nothing from the
tracked staging area is there and "git status" is unchanged - still 6
tracked deleted files.

I don't know what went wrong and I am unable to fix it - help
appreciated.
I can't share the whole git repository but I can try whatever git
command or other tool output may help here to shed some light on this -
as written I don't have a clear reproducer, I just have my branch with
a borked staging area.

thx and kind regards

Torsten

PS: Of cause I can delete the whole repo and clone it again or remove
the branch and start from a fresh new one ;) but I want to analyse
this.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-02-05 20:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).