Why won't “git reset HEAD” undo my uncommitted, unstaged changes?

后端 未结 6 1508
失恋的感觉
失恋的感觉 2021-02-05 09:30

I\'ve previously been able to undo changes through SourceTree by performing the \"Discard\" function, which under the hood produces this command:

git -c diff.mne         


        
6条回答
  •  广开言路
    2021-02-05 09:51

    "Why is it still listed as an unstaged change?"

    Because bare git reset HEAD does not do anything to your working tree. It only resets the HEAD pointer to the commit you name (a no-op in this case, since you name HEAD), and resets the index to match the new HEAD (which, again, is the same in this case - so the net effect is basically only throwing away any git add, git rm, etc. commands you had done).

提交回复
热议问题