Git development
 help / color / mirror / Atom feed
* meaning of "-g" in git-describe output
@ 2010-03-17 22:20 Markus Heidelberg
  2010-03-17 23:14 ` Jay Soffian
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Heidelberg @ 2010-03-17 22:20 UTC (permalink / raw)
  To: git

Hello,

what is the meaning of the character 'g' in output like v1.0.4-14-g2414721 ?
Is it simply the first letter, which isn't used in hexadecimal numbers
or has it a deeper sense?

Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: meaning of "-g" in git-describe output
  2010-03-17 22:20 meaning of "-g" in git-describe output Markus Heidelberg
@ 2010-03-17 23:14 ` Jay Soffian
  2010-03-18  1:19   ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Jay Soffian @ 2010-03-17 23:14 UTC (permalink / raw)
  To: Markus Heidelberg; +Cc: git, Linus Torvalds

On Wed, Mar 17, 2010 at 6:20 PM, Markus Heidelberg
<markus.heidelberg@web.de> wrote:
> Hello,
>
> what is the meaning of the character 'g' in output like v1.0.4-14-g2414721 ?
> Is it simply the first letter, which isn't used in hexadecimal numbers
> or has it a deeper sense?

My guess, from 908e531 (Add a "git-describe" command, 2005-12-24), is
that it's short for "git":

    IOW, with something like Junios current tree, I get:

        [torvalds@g5 git]$ git-describe parent
        refs/tags/v1.0.4-g2414721b

    ie the current head of my "parent" branch (ie Junio) is based on v1.0.4,
    but since it has a few commits on top of that, it has added the git hash
    of the thing to the end: "-g" + 8-char shorthand for the commit
    2414721b194453f058079d897d13c4e377f92dc6.

    -- http://marc.info/?t=113546113600001

But I think only Linus (+cc) knows. :-)

j.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: meaning of "-g" in git-describe output
  2010-03-17 23:14 ` Jay Soffian
@ 2010-03-18  1:19   ` Linus Torvalds
  2010-03-22 20:45     ` [PATCH] Documentation: explain the " Markus Heidelberg
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2010-03-18  1:19 UTC (permalink / raw)
  To: Jay Soffian; +Cc: Markus Heidelberg, git



On Wed, 17 Mar 2010, Jay Soffian wrote:
> 
> My guess, from 908e531 (Add a "git-describe" command, 2005-12-24), is
> that it's short for "git":

Indeed. I actually wanted to make it possible to use other SCM's, even if 
it's stupid. And git is not the only one that uses hashes for versioning, 
so the "g" prefix is there to allow others that use -hg or monotone or 
similar to work.

For the kernel, if you use mercurial, the kernel version prefix will be 
"hg", for example. For SVN, it will be "svn" (but the numbers won't be a 
hex number, they'll be the SVN revno). See 'scripts/setlocalversion' in 
the kernel tree for an example.

So 'git describe' tries to match this kind of "multi-SCM model", where you 
can describe versions of your software in an environment where people may 
well use different SCMs.

Of course, if you use "git describe", you'll always get the "g" thing, and 
it is entirely redundant within the settign of just git. But in a bigger 
setting, the point is that I can do this:

	[torvalds@i5 linux]$ git describe; uname -r
	v2.6.34-rc1-997-ga3d3203
	2.6.34-rc1-00959-gbca14dd

and they have basically the same format (not 100% identical, but the 
"-g<sha1>" part is similar - the SHA1's obviously don't match in this 
case, because the kernel I'm running is ~40 commits away from my current 
tip of tree, but you can see the pattern).

			Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Documentation: explain the meaning of "-g" in git-describe output
  2010-03-18  1:19   ` Linus Torvalds
@ 2010-03-22 20:45     ` Markus Heidelberg
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Heidelberg @ 2010-03-22 20:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Linus Torvalds, Jay Soffian, git

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---

Linus Torvalds, 2010-03-18 02:19:
> 
> On Wed, 17 Mar 2010, Jay Soffian wrote:
> > 
> > My guess, from 908e531 (Add a "git-describe" command, 2005-12-24), is
> > that it's short for "git":
> 
> Indeed. I actually wanted to make it possible to use other SCM's, even if 
> it's stupid. And git is not the only one that uses hashes for versioning, 
> so the "g" prefix is there to allow others that use -hg or monotone or 
> similar to work

I really hadn't thought of this obvious explanation.

 Documentation/git-describe.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index 6fc5323..d9311dd 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -105,6 +105,9 @@ The number of additional commits is the number
 of commits which would be displayed by "git log v1.0.4..parent".
 The hash suffix is "-g" + 7-char abbreviation for the tip commit
 of parent (which was `2414721b194453f058079d897d13c4e377f92dc6`).
+The "g" prefix stands for "git" and is used to allow describing the version of
+a software depending on the SCM the software is managed with. This is useful
+in an environment where people may use different SCMs.
 
 Doing a 'git describe' on a tag-name will just show the tag name:
 
-- 
1.7.0.3.257.gcd709

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-22 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-17 22:20 meaning of "-g" in git-describe output Markus Heidelberg
2010-03-17 23:14 ` Jay Soffian
2010-03-18  1:19   ` Linus Torvalds
2010-03-22 20:45     ` [PATCH] Documentation: explain the " Markus Heidelberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox