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

Re: who's on first? - following first parent and merge-management

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 7, 2012, 07:37 UTC
Message-ID
<7vwr6woo8p.fsf@alter.siamese.dyndns.org>
In-Reply-To
<jj6s47$m98$1@dough.gmane.org>
Neal Kreitzinger <nkreitzinger@gmail.com> writes:
Show 5 quoted lines
> Please advise on "first parent" intent, best-practices, and pitfalls,
> or documentation that explains it.  (I haven't found documentation
> that directly explains "first parent theory and practice".  I've seen
> many references to "first parent" and its implied meaning that I'm
> supposed to "just know" or deduce).

A short conclusion: if you take "first parentness" very seriously, neither of your two approaches are optimal, but that does not make you a bad person. It is just that "log --first-parent" is not the best way to get an overview of the history for your workflow.

The mechanical definition of "first parent" is that:
 - A merge is a commit with more than one parent.
 - When you run "merge", you are on one commit, HEAD, taking changes
   made by "other branches" you are merging into "your history"
   (whose definition is "the commit-dag leading to your HEAD
   commit"), and record the resulting tree as a new commit.
 - This new commit records all its parents, one of them being your
   old "HEAD" and the rest being "other branches" you merged into
   "your history".  They are recorded in that order in the resulting
   commit ("git cat-file commit HEAD" after a merge to see them).

Hence, the first parent of a merge is the HEAD the committer was at when s/he ran "git merge".

It's late so I won't go into the details of what the implications of this is in this message. Perhaps tomorrow when/if I have time.

Previous: Neal KreitzingerNext: Junio C Hamano
Message 2 of 13 in “who's on first? - following first parent and merge-management”
  1. Neal KreitzingerMar 7, 2012
  2. Junio C HamanoMar 7, 2012
  3. Junio C HamanoMar 8, 2012
  4. Jeff KingMar 8, 2012
  5. Junio C HamanoMar 8, 2012
  6. Johannes SixtMar 8, 2012
  7. Junio C HamanoMar 8, 2012
  8. Holger HellmuthMar 9, 2012
  9. Johannes SixtMar 9, 2012
  10. Holger HellmuthMar 9, 2012
  11. Junio C HamanoMar 9, 2012
  12. Jonathan NiederMar 8, 2012
  13. Junio C HamanoMar 8, 2012

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.