git reset 询问“更多?”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14203952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git reset asks 'more?'
提问by norbertas.gaulia
Git windows command line, version 1.8.0
Git windows 命令行,版本 1.8.0
I have 3 commits so far and when I type
到目前为止,我有 3 次提交,当我输入时
git reset --soft HEAD^
new line comes up with
新线出现
More?
and flashing cursor for input
和闪烁的光标输入
Then, whatever I type, I always get
然后,无论我输入什么,我总是得到
fatal: ambiguous argument 'HEAD ': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]
致命:模棱两可的参数“HEAD”:未知版本或路径不在工作树中。使用“--”将路径与修订分开,如下所示:“git [...] -- [...]
All other commands works fine in the same folder.
所有其他命令在同一文件夹中都可以正常工作。
采纳答案by Adam Dymitruk
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.
看看是否git log HEAD^
有效。如果没有,则可能与您的本地化或终端有关。它似乎正在过滤掉^
符号。作为一种解决方法,暂时使用git reset --soft HEAD~1
。
回答by me_and
Your shell is interpreting the ^
symbol as a line continuation symbol. Either just avoid using ^
as Adamsuggests:
您的 shell 正在将该^
符号解释为行继续符。要么避免^
像亚当建议的那样使用:
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):
或引用参数,以便 shell 不会尝试解释它(我不确定您正在使用哪个 shell,但如果这不起作用,我会感到惊讶):
git reset --soft "HEAD^"
回答by mcdon
The ^ is an escape character in the Windows Command Line. Use ^^ instead of ^.
^ 是 Windows 命令行中的转义字符。使用 ^^ 而不是 ^。
git reset --soft HEAD^^
See Rob Van Der Woude's Scripting Pagesfor details on Escape Characters.
有关转义字符的详细信息,请参阅Rob Van Der Woude 的脚本页面。