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

Re: cherry-pick '-m' curiosity

From
Sergey Organov <sorganov@gmail.com>
Date
Feb 6, 2018, 13:05 UTC
Message-ID
<87y3k6tgi4.fsf@javad.com>
In-Reply-To
<xmqqtvuv9po8.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 24 quoted lines
> Sergey Organov <sorganov@gmail.com> writes:
>
>> Isn't it always the case that "mainline" is the first parent, as that's
>> how "git merge" happens to work?
>
> You may not be merging into the "mainline" in the first place.
>
> Imagine forking two topics at the same commit on the mainline, and
> merging these two topics of equal importance together into a single
> bigger topic, before asking the mainline to pull the whole.
>
>     $ git checkout mainline
>     $ git tag fork-point
>     $ git checkout -b frontend-topic fork-point
>     $ work work work
>     $ git checkout -b backend-topic fork-point
>     $ work work work
>     $ git checkout -b combined
>     $ git merge frontend-topic
>     $ git tag merged
>
> The backend-topic may be recorded as the first-parent of the
> resulting merge, but logically the two topics are of equal footing,
> so merge^1..merge and merge^2..merge are both equally interesting.
Point taken, thanks! Now, if I reformulate my original question as:
"Isn't it _usually_ the case that "mainline" is the first parent?"
what is the answer?
For example, in the above case I'd likely rather: 
     $ git checkout -b combined fork-point
     $ git merge --no-ff frontend-topic
     $ git merge --no-ff backend-topic
and still have clear "mainline" on "-m1" for both merges.
I'm asking because those:

"Usually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline."

in the manual page still feels confusing in the context of typical git usage (as opposed to the context of abstract DAG operations where it'd make sense indeed.)

-- Sergey
Previous: Junio C HamanoNext: Stefan Beller
Message 3 of 7 in “cherry-pick '-m' curiosity”
  1. Sergey OrganovFeb 5, 2018
  2. Junio C HamanoFeb 5, 2018
  3. Sergey OrganovFeb 6, 2018
  4. Stefan BellerFeb 5, 2018
  5. Sergey OrganovFeb 6, 2018
  6. G. Sylvie DaviesFeb 19, 2018
  7. Sergey OrganovFeb 20, 2018

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.