Git 重置问“更多?”

Git windows 命令行,版本1.8.0

到目前为止,我已经提交了3次

git reset --soft HEAD^

新台词

More?

和闪烁光标的输入

然后,不管我打什么,我总是得到

模棱两可的论点 : 工作树中未知的修订或路径。 使用“——”将路径与修订分开,如下所示: Git [ ... ]——[ ... ]

所有其他命令在同一个文件夹中都可以正常工作。

32512 次浏览

see if git log HEAD^ works. If it doesn't, it may be something with your localization or terminal. It seems to be filtering out the ^ symbol. As a workaround, use git reset --soft HEAD~1 for now.

Your shell is interpreting the ^ symbol as a line continuation symbol. Either just avoid using ^ as Adam suggests:

git reset --soft HEAD~1

or quote the argument so the shell doesn't attempt to interpret it (I'm not sure exactly which shell you're using, but I'd be surprised if this doesn't work):

git reset --soft "HEAD^"

The ^ is an escape character in the Windows Command Line. Use ^^ instead of ^.

git reset --soft HEAD^^

See Rob Van Der Woude's Scripting Pages for details on Escape Characters.

For Windows OS,

git log HEAD^^

will work. I have run this command and from the three files it uncommit the most recent one and shows the other two files. The other two files are in below. So, hopefully it will work.

`C:\Users\pqplz947\Desktop\saumen>git log HEAD^^

commit b8b6591a468e4c9d412a75ce8594bcfc844dc159

Author: Saumen saumencs3j6@gmail.com

Date: Mon Apr 18 21:47:32 2022 -0600

day2.txt

commit ba8a9cac92a25d5e1ba35a41fb5121441cd1de27

Author: Saumen saumencs3j6@gmail.com

Date: Mon Apr 18 21:43:33 2022 -0600

Day1 data is added

C:\Users\pqplz947\Desktop\saumen>`