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

Re: ancestor and descendant ~ clarification needed

From
EGEtienne Girard <etienne.g.girard@gmail.com>
Date
Oct 22, 2015, 12:58 UTC
Message-ID
<CAJA=mv4AdGmEOBNugEMemYNvhCqFqpoa0_qs1gpWRXvMJaSg_g@mail.gmail.com>
In-Reply-To
<CAAF+z6HEeFEYD9R+6Uz3ebRYNMpy5Gh0Fo9EjpaTYwSbqyDLgQ@mail.gmail.com>
Hello,

I think you're right, branch A is a descendant of master. We could change the misleading sentence to "However, if the current branch is a descendant of the other - if its head is a descendant of the other's head - [...]", to link back to the definition of descendant for commits.

2015-10-22 11:06 GMT+02:00 Xue Fuqiao <xfq.free@gmail.com>:
Show 43 quoted lines
> Hi,
>
> In Documentation/user-manual.txt:
>
>    In the following, we say that commit X is "reachable" from commit Y
>    if commit X is an ancestor of commit Y.  Equivalently, you could say
>    that Y is a descendant of X, or that there is a chain of parents
>    leading from commit Y to commit X.
> [...]
>    However, if the current branch is a descendant of the other--so every
>    commit present in the one is already contained in the other--then Git
>    just performs a "fast-forward"; the head of the current branch is
>    moved forward to point at the head of the merged-in branch, without
>    any new commits being created.
>
> I'm a Git newbie.  According to my understanding, the "descendant" in
> the second paragraph above should be "ancestor".  I attempt to represent
> my understanding using the following diagram (please see it in a
> monospaced font):
>
> ................................................
>
>          o--o--o <-- Branch A
>         /
>  o--o--o <-- master
>
> ................................................
>
> "master" is the current branch, and (as I understand it) it is an
> ancestor of "Branch A", because there is a chain of parents leading from
> "Branch A" to master.  So "Branch A" (i.e., "the other" branch, or the
> "merged-in" branch) is a descendant of master.  I even set up a test
> repository and attempted to test the above diagram with "git merge-base
> --is-ancestor" (and "echo $?"), but it seems to me that the master
> branch is *not* a descendant of "Branch A".
>
> I hope you can understand my words here (English is not my native
> language).  Can anyone point me in the right direction (what am I
> missing)?
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Xue FuqiaoNext: Junio C Hamano
Message 2 of 7 in “ancestor and descendant ~ clarification needed”
  1. Xue FuqiaoOct 22, 2015
  2. Etienne GirardOct 22, 2015
  3. Junio C HamanoOct 22, 2015
  4. Xue FuqiaoOct 23, 2015
  5. Junio C HamanoOct 23, 2015
  6. Xue FuqiaoOct 23, 2015
  7. Junio C HamanoOct 24, 2015

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.