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

Re: why the 'g' prefix on the SHA1 in git-describe output?

From
Andreas Ericsson <ae@op5.se>
Date
Nov 3, 2007, 15:18 UTC
Message-ID
<472C915E.8070205@op5.se>
In-Reply-To
<8c5c35580711030656h23d5910ah824de41a2cf4eafe@mail.gmail.com>
Lars Hjemli wrote:
Show 7 quoted lines
> On Nov 3, 2007 1:25 PM, Jim Meyering <jim@meyering.net> wrote:
>> Can anyone tell me what motivated adding the 'g' prefix on the SHA1 in
>> git-describe output?
> 
> I'm not sure what _motivated_ the 'g', but currently git-rev-parse
> understands the output from git-describe _if_ the 'g' is present.
> 

It's been there since 908e5310b958619559d34b0b6da122f058faa47e, which has the commit-subject 'Add a "git-describe" command'.

I think it'd be more trouble removing it now than it is to keep it, since a lot of script depend on it being there for parsing out versioning info in various autobuild- and release scripts.

If you want to change it, I'd suggest adding a "--no-sha1" option that makes the entire "-g%s" part of the output go away, or perhaps adding a --format="%v-%d-%g" (for the default behaviour).

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Lars HjemliNext: Jim Meyering
Message 3 of 4 in “why the 'g' prefix on the SHA1 in git-describe output?”
  1. Jim MeyeringNov 3, 2007
  2. Lars HjemliNov 3, 2007
  3. Andreas EricssonNov 3, 2007
  4. Jim MeyeringNov 3, 2007

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.