git reset asks 'more?'

后端 未结 3 1586
忘了有多久
忘了有多久 2020-12-04 20:47

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

相关标签:
3条回答
  • 2020-12-04 21:15

    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^"
    
    0 讨论(0)
  • 2020-12-04 21:20

    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.

    0 讨论(0)
  • 2020-12-04 21:23

    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.

    0 讨论(0)
提交回复
热议问题