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

Re: Creating something like increasing revision numbers

From
David Aguilar <davvid@gmail.com>
Date
Oct 21, 2009, 07:47 UTC
Message-ID
<20091021074711.GB67773@gmail.com>
In-Reply-To
<20091019004447.GC11739@gamma.logic.tuwien.ac.at>
On Mon, Oct 19, 2009 at 02:44:47AM +0200, Norbert Preining wrote:
Show 18 quoted lines
> Hi all,
> 
> thanks everyone for the nice feedback!
> 
> On So, 18 Okt 2009, Daniel Barkalow wrote:
> > It's possible as long as you don't think of the "version number" as a 
> > property of the commit, but rather a property that some commits get by 
> > virtue of having been at some time the commit that's what would be found 
> > on that particular server at that particular time. Even though the history 
> 
> Right! That is a good point. In fact I don't care about (local) commits,
> but about the pushes to the central server.
> 
> > of the *content* is non-linear, the sequence of values stored in 
> > refs/heads/master on your central server is linear, local, and easy to 
> > enumerate.
> 
> That is exactely what I need.

If you have any control over how people will use git, then you can give your constantly-incrementing revision number more stability by ensuring that everyone uses 'git pull --rebase'.

That'll literally keep the history completely linear. If someone forgets then it's not a big deal; you'll just get a merge commit and the number will increment by 2 instead of by 1.

> Now my follow-up questions:
> - how would one access this "sequence" number on the server

If you've done the "tag the initial commit" as suggested elsewhere on this thread:

	git tag projectname $(git rev-list HEAD | tail -n1)
then you can do this with simply:
	git describe --tags
It should output something like:
	projectname-101-g20912df
> - is there a way to determine at which of this "sequence" numbers a specific
>   file has been changed last?
	commit=$(git log --pretty=%H -1 -- <filename>)
	git describe --tags $commit
> JAIST Japan Advanced Institute of Science and Technology   preining@jaist.ac.jp
> Vienna University of Technology                               preining@logic.at
> Debian Developer (Debian TeX Task Force)                    preining@debian.org
Just another happy Debian user here,
-- 
		David
Previous: Johannes Sixt
Message 23 of 23 in “Creating something like increasing revision numbers”
  1. Norbert PreiningOct 18, 2009
  2. Johan HerlandOct 18, 2009
  3. Norbert PreiningOct 18, 2009
  4. Johan HerlandOct 18, 2009
  5. alexandrulOct 18, 2009
  6. Nicolas PitreOct 19, 2009
  7. Junio C HamanoOct 18, 2009
  8. Norbert PreiningOct 19, 2009
  9. alexandrulOct 18, 2009
  10. demerphqOct 18, 2009
  11. Norbert PreiningOct 18, 2009
  12. demerphqOct 18, 2009
  13. alexandrulOct 18, 2009
  14. Jon SmirlOct 18, 2009
  15. Daniel BarkalowOct 18, 2009
  16. Norbert PreiningOct 19, 2009
  17. Daniel BarkalowOct 19, 2009
  18. Norbert PreiningOct 19, 2009
  19. Daniel BarkalowOct 19, 2009
  20. Nicolas PitreOct 19, 2009
  21. Norbert PreiningOct 19, 2009
  22. Johannes SixtOct 19, 2009
  23. David AguilarOct 21, 2009

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.