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

Re: [RFD] Git glossary: 'branch' and 'head' description

From
Jakub Narebski <jnareb@gmail.com>
Date
May 17, 2006, 19:13 UTC
Message-ID
<e4fsla$oth$1@sea.gmane.org>
In-Reply-To
<7viro4ecao.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
Show 13 quoted lines
>> In 'Documentation/glossary.txt' we have:
>> ----  
>> branch::
>>         A non-cyclical graph of revisions, i.e. the complete history of
>>         a particular revision, which is called the branch head. The
>>         branch heads are stored in `$GIT_DIR/refs/heads/`.
>> ---- 
> 
> While technically it might be correct, the above description for
> "branch" completely misses the point in the context of other
> entries.  I do not recall when this entry was first written, but
> I suspect it probably predates other entries that talk about the
> same thing.
[cut long description]

The description you gave is nice, but it belongs in Tutorial rather than in Glossary. Additionally it mainly deals with branches fron the 'revision history' point of view, although the 'commit' point of view can also be seen.

Glossary entry should be short, up to the point, and encompass al three points of view:

 a.) conceptual point of view, i.e. "branch is separate line of
development" (be it stable or development direction, introducing new
feature aka. 'topic', or following aka. 'tracking' changes in other
repository),
 b) revision history point of view, i.e. "on branch means, roughly,
reachable from branch head aka. tip", or "branch is lineage of history of
project" (somewhat mudded by merges[*1*], fork points[*2*] and multiple
roots). This is what current glossary entry tries to present,
 c) commit point of view, i.e. "branch tip is where we do commit
changes" (branch tip is [one of] parent(s) of current commit, and branch
tip is advanced to new commit).
[*1*] Problem with merges:
   
   ---.---.---A-\--.---.---.---B-- branch1
                 \
   ---.---.---C---*D---.---.---E-- branch2   
   
Does A belong to branch2? It is one of parents of commit D. We can assume
that only first parent in merges continues branch. But what if we have the
following history:
   ---.---.---A-\  <---- there was branch1 here
                 \
   ---.---.---C---*D---.---.---E-- branch2 
To which branch belongs A then?
[*2*] Problem with fork point
           /--1---2---3-- maintenance/stable/fixes branch  
          /
  ---A---B----C---D---E-- master/development branch

Following the ancestry chain we get that commit A is on branch 'maint' (it is also on branch 'master'); git does not record fork points. Perhaps the branch logging and/or per branch configuration could be used to resolve this issue.

-- 
Jakub Narebski
Warsaw, Poland
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 13 in “[RFD] Git glossary: 'branch' and 'head' description”
  1. Jakub NarebskiMay 17, 2006
  2. Junio C HamanoMay 17, 2006
  3. Jakub NarebskiMay 17, 2006
  4. Junio C HamanoMay 17, 2006
  5. Jakub NarebskiMay 17, 2006
  6. David KågedalMay 19, 2006
  7. Shawn PearceMay 19, 2006
  8. Daniel BarkalowMay 20, 2006
  9. Junio C HamanoMay 20, 2006
  10. Daniel BarkalowMay 20, 2006
  11. Linus TorvaldsMay 20, 2006
  12. Shawn PearceMay 21, 2006
  13. Jakub NarebskiMay 21, 2006

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.