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

Re: Git commit generation numbers

From
GSGeorge Spelvin <linux@horizon.com>
Date
Jul 21, 2011, 12:55 UTC
Message-ID
<20110721125544.26006.qmail@science.horizon.com>
In-Reply-To
<1311249789.9745.30.camel@drew-northup.unet.maine.edu>
Show 9 quoted lines
> I have not read yet one discussion about how generation numbers [baked
> into a commit] deal with rebasing, for instance. Do we assign one more
> than the revision prior to the base of the rebase operation or do we
> start with the revision one after the highest of those original commits
> included in the rebase? Depending on how that is done
> _drastically_different_ numbers can come out of different repository
> instances for the same _final_ DAG. This is one major reason why, as I
> see it, local storage is good for generation numbers and putting them in
> the commit is bad. 

Er, no. Whenever a new commit object is generated (as the result of a rebase or not), its commit number is computed based on its parent commits. It is NEVER copied.

Just like the parent pointers themselves. Remember, even though we talk about "the same commit" after rebasing, it's really just an EQUIVALENT commit according to some higher-level concept of similarity. As far as the core git engine is concerned, it's always a DIFFERENT commit, with different parent hashes and a different hash itself.

This point hasn't been mentioned explicltly precisely because it's so obvious; the history-walking code that the generation numbers are for requires this property to function.

Previous: Drew NorthupNext: Drew Northup
Message 2 of 7 in “Re: Git commit generation numbers”
  1. Drew NorthupJul 21, 2011
  2. George SpelvinJul 21, 2011
  3. Drew NorthupJul 21, 2011
  4. Phil HordJul 21, 2011
  5. Pēteris KļaviņšJul 21, 2011
  6. Christian CouderJul 22, 2011
  7. George SpelvinJul 21, 2011

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.