Re: git MFC/cherry-pick question

From: Alan Somers <asomers_at_freebsd.org>
Date: Fri, 04 Jun 2021 02:28:18 UTC
On Thu, Jun 3, 2021 at 8:13 PM Rick Macklem <rmacklem@uoguelph.ca> wrote:

> Hi,
>
> I am trying to MFC a commit to stable/12.
> The cherry-pick works, but the resultant code
> is not correct and won't build.
> --> I broke the build yesterday and manually
>        reverted the breakage.
>
> So, how do I do this?
>
> Do I have to manually edit the file after the
> cherry-pick and then do something like a
> git commit -a
> to get the edited change in, or is there a
> way to tell it to add it to the cherry-pick or ??
>
> Thanks anyone, for help with this, rick
>

Is the resulting code incorrect because of a git merge error, or because
stable/13 requires slightly different code than main?  If it's the latter,
then after the "git cherry-pick", you should edit the file manually and do
a "git commit -a --amend".  That will produce the right result.  You don't
have to worry about screwing up merge history by using "--amend", because
"git cherry-pick" already screws up merge history.  If your problem is the
former, then the same solution will work, although you might be able to
solve it by using some fancy git merge options instead.

-Alan