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

Re: How to check out the repository at a particular point in time

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 23, 2011, 16:53 UTC
Message-ID
<20110823165359.GD3545@elie.gateway.2wire.net>
In-Reply-To
<CAMOZ1BuMfUT4D_UasLXsjDrXRKDw4EF_U-CV8tsS9W7AP+f8ow@mail.gmail.com>
Michael Witten wrote:
> Indeed. That example makes perfect sense when so-called `branches'
> master and new-feature are rightfully thought of as the `pointers'
> (or, `references') that they are.

You are right to point out there is potential for confusion, because different VCSes model the practice of branching and merging in so many different ways:

 - a single text field in each commit, as in Mercurial
 - a list of "sticky" keywords attached to each commit, as in CVS
 - special revision numbers, as in CVS
 - special directory names, as in Subversion
 - pointers to the tip of a line of history, as in Git

Each model has its strengths and weaknesses in terms of supporting different operations one might to perform on a branch:

 - creating a branch
 - advancing a branch
 - studying the history of development on a single branch
 - fetching and pushing
 - renaming a branch
 - deleting
 - comparing the history of two branches
 - merging and deleting the now-merged-in branch
 - merging and not deleting the now-merged-in branch
 - "context switch" from working on one branch to another

In particular, you are right to emphasize that in git's model, "what was on the foo branch at 12:00pm on Saturday" is just not a well defined question. The foo branch tip might have been at commit A on my machine, commit B on a server we share, and commit C on your machine, so Git doesn't even bother --- branch refs are pointers into history rather than participating in the history themselves.

Instead, we can content ourselves with the answers to questions like "what was in the foo branch at 12pm on Saturday on the server used as a rendezvous point", by logging in and examining the reflog on the server.

A nice side-benefit is that branch refs are considered to be _private_ unless they are pushed or mentioned in a commit message. So there is no pressure to come up with good names for them.

Hope that helps, Jonathan

Previous: Michael WittenNext: Andreas Ericsson
Message 9 of 12 in “How to check out the repository at a particular point in time”
  1. R. DiezAug 22, 2011
  2. Thomas RastAug 22, 2011
  3. R. DiezAug 22, 2011
  4. Jens LehmannAug 22, 2011
  5. Michael WittenAug 23, 2011
  6. Jonathan NiederAug 23, 2011
  7. Matthieu MoyAug 23, 2011
  8. Michael WittenAug 23, 2011
  9. Jonathan NiederAug 23, 2011
  10. Andreas EricssonAug 24, 2011
  11. Randal L. SchwartzAug 24, 2011
  12. Michael WittenAug 24, 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.