Re: Creating something like increasing revision numbers

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

 



On Sunday 18 October 2009, Norbert Preining wrote:
> On So, 18 Okt 2009, Johan Herland wrote:
> >     $ git describe
> >     v1.0.4-14-g2414721
> >
> > where the "v1.0.4" part is the last tag that the current state is based
> > on, the "14" part is the number of commit between that tag and the
> > current
> 
> So if we have only one tag (initial) then it would count the number
> of commits?

Yes. You can create the 'initial' tag with

  git rev-list HEAD | tail -n1 | xargs git tag initial

and from then on

  git describe --tags --match initial | cut -d'-' -f2

will give you the increasing "revision" number you're looking for. Just be 
aware that if you have two parallel branches with the same number of 
commits, they will give you the same number. I.e. this only works for a 
single, stable (i.e. no history rewrites), branch of development.


Hope this helps,

...Johan

-- 
Johan Herland, <johan@xxxxxxxxxxx>
www.herland.net
--
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]