Web lists-archives.com

Re: cherry-pick '-m' curiosity

Sergey Organov <sorganov@xxxxxxxxx> 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.