4

Possible Duplicate:
How to retrieve the hash for the current commit in Git?

I.e. what's the git equivalent of hg parent or svn info.

Extra points for an answer that I can use in a script, i.e. It gives 'bbh653ad' rather than a load of words which contain the version number somewhere

Community
  • 1
  • 1
John Lawrence Aspden
  • 17,124
  • 11
  • 67
  • 110

1 Answers1

6

To get the hash of the HEAD, use this command:

git rev-parse HEAD

or for the short form:

git rev-parse --short HEAD

If you have tags and you are looking for a more descriptive revision number, you can consider using the result of the command:

git describe --long
ouah
  • 142,963
  • 15
  • 272
  • 331