git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Neal Kreitzinger <nkreitzinger@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: who's on first? - following first parent and merge-management
Date: Tue, 06 Mar 2012 23:37:42 -0800	[thread overview]
Message-ID: <7vwr6woo8p.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <jj6s47$m98$1@dough.gmane.org> (Neal Kreitzinger's message of "Tue, 06 Mar 2012 23:36:06 -0600")

Neal Kreitzinger <nkreitzinger@gmail.com> writes:

> 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.

  reply	other threads:[~2012-03-07  7:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07  5:36 who's on first? - following first parent and merge-management Neal Kreitzinger
2012-03-07  7:37 ` Junio C Hamano [this message]
2012-03-08  6:13   ` Junio C Hamano
2012-03-08  7:14     ` Jeff King
2012-03-08  7:38       ` Junio C Hamano
2012-03-08  8:03       ` Johannes Sixt
2012-03-08 17:30         ` Junio C Hamano
2012-03-09 12:05           ` Holger Hellmuth
2012-03-09 12:29             ` Johannes Sixt
2012-03-09 13:25               ` Holger Hellmuth
2012-03-09 16:26                 ` Junio C Hamano
2012-03-08  7:49     ` Jonathan Nieder
2012-03-08 22:52       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vwr6woo8p.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=nkreitzinger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).