git reset asks 'more?'

GitVersion Control

Git Problem Overview


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.

Git Solutions


Solution 1 - Git

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 - Git

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 - Git

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 - Git

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>`

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionnorbertas.gauliaView Question on Stackoverflow
Solution 1 - GitAdam DymitrukView Answer on Stackoverflow
Solution 2 - Gitme_andView Answer on Stackoverflow
Solution 3 - GitmcdonView Answer on Stackoverflow
Solution 4 - GitRoyView Answer on Stackoverflow