Search code examples
git

Why do HEAD and HEAD^ show the same commit id in cmd.exe?


I am new to git and trying to understand HEAD and HEAD^. When I am trying to do git rev-parse, I am seeing both HEAD and HEAD^ showing the same commit id.

Note: Latest commit is a merge commit happened by merging a pull request. Please help me understand or let me know if I am missing something here.

Screenshot: enter image description here


Solution

  • ^ is the cmd.exe escape character, like \ in unix. You typed ^ at the end of the line and cmd prompted you for the line continuation,

    Say echo ^ (with the space on the end) to see what rev-parse saw.

    Quote your arguments if they contain any of your shell's command-line-construction syntax you don't want to use that way.