'How can I quickly check the value of ORIG_HEAD?
I would just like to echo the value of ORIG_HEAD at the command line -- how can I do this? To no avail I tried:
$ echo $ORIG_HEAD
and
$ git echo $ORIG_HEAD
Solution 1:[1]
You can see what commit ORIG_HEAD
points to by using the log
command of git:
git log -1 ORIG_HEAD
What you tried, $ORIG_HEAD
is parsed by your shell, treating it as a variable that was probably not set so effectively running
echo
git echo
Where git echo
is an invalid git command.
Solution 2:[2]
If you are just looking for the SHA-1 to be able to pipe to something other command, as @torek mentioned you could do...
git rev-parse ORIG_HEAD
This comes from the .git/ORIG_HEAD
file. So you could also do this...
cat .git/ORIG_HEAD
It is of course worth mentioning that ORIG_HEAD
and HEAD
are not the same. More about that here. So if you came here looking for how to get the SHA-1 of the HEAD
use this instead...
git rev-parse HEAD
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 | fejese |
Solution 2 | Daniel Morell |