Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find out which version I've got checked out in git? [duplicate]

Tags:

git

parent

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

like image 475
John Lawrence Aspden Avatar asked Oct 13 '25 01:10

John Lawrence Aspden


1 Answers

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
like image 126
ouah Avatar answered Oct 14 '25 17:10

ouah