git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: meaning of "-g" in git-describe output

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 18, 2010, 01:19 UTC
Message-ID
<alpine.LFD.2.00.1003171811420.18017@i5.linux-foundation.org>
In-Reply-To
<76718491003171614r2e8ce0e5r3e4799503194831c@mail.gmail.com>
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
Previous: Jay SoffianNext: Markus Heidelberg
Message 3 of 4 in “meaning of "-g" in git-describe output”
  1. Markus HeidelbergMar 17, 2010
  2. Jay SoffianMar 17, 2010
  3. Linus TorvaldsMar 18, 2010
  4. Documentation: explain the meaning of "-g" in git-describe outputMarkus Heidelberg, Mar 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.