Re: Stamp Git commit id into file during build process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Richards <paul.richards@xxxxxxxxx> writes:

> Hi,
> I am in the process of migrating from Subversion to Git.  One thing I
> am unsure of is how to stamp the 'version' or 'commit id' into a file
> as part of a build process.
> 
> With subversion I used the SubWCRev tool from TortoiseSVN
> (http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev.html).
> 
> With Git I imagine that I'd like to put a copy of the current commit
> id (either the full hash or a truncated version of that) into a file
> which then gets included into the program source code in some way.
> 
> Is there a recommended way of doing this with git?  Perhaps with
> something similar to SubWCRev?
> 
> Currently I am thinking about using "git log", and grepping the output
> in some way so that I just get the hash.

Not "git log".

Take a look how for example git project and Linux kernel use "git describe"
in GIT-VERSION-GEN script, and how they use GIT-VERSION-GEN script in the
Makefile.

-- 
Jakub Narebski
Poland
ShadeHawk on #git
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]