If I may reformulate your question: how can I include revision information 
in my build?

As far as I can remember, in SVN some did it differently by having a 
keywords in files that would be replaced during commit (a similar question 
is discussed here on 

Now I'm a bit unsure what you want, but I'll assume you want to know the 
HEAD revision of the repo of which you are building, and put this into some 

It is usually the job of the build-tool to fetch and include this 
information. So somewhere in your build-script, you need to do something 
like this:

$ echo "Timestamp: "`date` >> version.txt
$ echo "Revision: "`git rev-parse HEAD` >> version.txt
$ echo "Tag: "`git name-rev --tags --name-only HEAD` >> version.txt

The resulting file:
$ cat version.txt
Build version information:
Timestamp: Wed Feb 8 12:27:28 CET 2012
Revision: 36909b1d55aa47a5c484808ce5cc5cbe06ed93e4
Tag: undefined

Different build tools have different ways of doing this. There could be 
that there is a plugin or feature in your build tool that produces a 
similar file.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit 
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to