'git reset asks 'more?'
Git windows command line, version 1.8.0
I have 3 commits so far and when I type
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 [...] -- [...]
All other commands works fine in the same folder.
Solution 1:[1]
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.
Solution 2:[2]
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^"
Solution 3:[3]
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.
Solution 4:[4]
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 [email protected]
Date: Mon Apr 18 21:47:32 2022 -0600
day2.txt
commit ba8a9cac92a25d5e1ba35a41fb5121441cd1de27
Author: Saumen [email protected]
Date: Mon Apr 18 21:43:33 2022 -0600
Day1 data is added
C:\Users\pqplz947\Desktop\saumen>`
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Adam Dymitruk |
Solution 2 | Community |
Solution 3 | mcdon |
Solution 4 | Roy |