Hi all, thanks for the tips. When I run describe I get an error: $ git describe --debug HEAD fatal: cannot describe '792815de6e3c2403f1e2ed5f2264ca88a0ae7000' Any hints why? I have a tag v1.3 attached to HEAD and all commited. CU, Alf On Mon, Jun 16, 2008 at 2:15 PM, Santi Béjar <sbejar@xxxxxxxxx> wrote: > On Mon, Jun 16, 2008 at 13:51, Alf Clement <alf.clement@xxxxxxxxx> wrote: >> Hi all, >> >> I want to compile the current repository hash id into my program, to >> be able to checkout later this >> id an see the exact files for the compile. It should flag if there are >> currently modified files in the >> directory tree. > > You can look at how git does it: > > http://git.kernel.org/?p=git/git.git;a=blob;f=GIT-VERSION-GEN;hb=HEAD > >> >> What would be the best command to get a unique identifier? > > "git rev-parse HEAD" for a unique identifier, > but "git describe" is more convenient/useful. > >> Do I need the 40 digit hash id? > > Normally 7 or 8 are sufficient. > >> How can I make sure that a shorter hash id will be unique? > > You can't. Even the 40 digit hash is "only" cryptographically unique. > But within a project 7 or 8 digits are unique enough for practical > use. > > Santi > -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html