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

Re: cherry-pick '-m' curiosity

From
G. Sylvie Davies <sylvie@bit-booster.com>
Date
Feb 19, 2018, 21:39 UTC
Message-ID
<CAAj3zPxiLxqgnKXth2EZZWwgYhW_cHEcxbM6_BqpzpHR_ipqyQ@mail.gmail.com>
In-Reply-To
<87wozry7z4.fsf@javad.com>
On Mon, Feb 5, 2018 at 3:46 AM, Sergey Organov <sorganov@gmail.com> wrote:
Show 12 quoted lines
> Hello,
>
> $ git help cherry-pick
>
> -m parent-number, --mainline parent-number
>            Usually you cannot cherry-pick a merge because you do not
>            know which side of the merge should be considered the
>            mainline.
>
> Isn't it always the case that "mainline" is the first parent, as that's
> how "git merge" happens to work?
>

First-parent will be whatever commit you were sitting on when you typed "git merge".

If you're sitting on your branch and you type "git fetch; git merge origin/master", then "mainline" will be 2nd parent.

Same happens if you type "git pull".

Further reading here: https://developer.atlassian.com/blog/2016/04/stop-foxtrots-now/

"git revert -m" also has the same problem.
> Is, say, "-m 2" ever useful?
>
> --
> Sergey
Previous: Sergey OrganovNext: Sergey Organov
Message 6 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.