git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: cherry-pick '-m' curiosity
Date: Tue, 06 Feb 2018 16:05:55 +0300	[thread overview]
Message-ID: <87y3k6tgi4.fsf@javad.com> (raw)
In-Reply-To: <xmqqtvuv9po8.fsf@gitster-ct.c.googlers.com> (Junio C. Hamano's message of "Mon, 05 Feb 2018 11:55:51 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> 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

  reply	other threads:[~2018-02-06 13:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 11:46 cherry-pick '-m' curiosity Sergey Organov
2018-02-05 19:55 ` Junio C Hamano
2018-02-06 13:05   ` Sergey Organov [this message]
2018-02-05 22:03 ` Stefan Beller
2018-02-06  9:25   ` Sergey Organov
2018-02-19 21:39 ` G. Sylvie Davies
2018-02-20 16:23   ` Sergey Organov

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

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

  git send-email \
    --in-reply-to=87y3k6tgi4.fsf@javad.com \
    --to=sorganov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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 NNTP newsgroup(s).