Date: Thu, 3 Jun 2021 21:06:20 -0600 From: Warner Losh <imp@bsdimp.com> To: Alan Somers <asomers@freebsd.org> Cc: Rick Macklem <rmacklem@uoguelph.ca>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: git MFC/cherry-pick question Message-ID: <CANCZdfoiWB_X5LmqtBG3L7jf7z-_0aeia1d9eYbdLgzg9pSKMg@mail.gmail.com> In-Reply-To: <CAOtMX2j=vM%2B4SS0Tp=n=S=epW5YG19%2Bqgx_Ly47i%2Bg9=UWJ7Jg@mail.gmail.com> References: <YQXPR0101MB09681229241CAD2BD91794ADDD3B9@YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM> <CAOtMX2j=vM%2B4SS0Tp=n=S=epW5YG19%2Bqgx_Ly47i%2Bg9=UWJ7Jg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000082ccb205c3e7fa78 Content-Type: text/plain; charset="UTF-8" On Thu, Jun 3, 2021 at 8:29 PM Alan Somers <asomers@freebsd.org> wrote: > 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. > git cherry-pick does not screw up merge history. The hashes of the diffs are used by git to know what's been merged and what hasn't. git commit --amend to fix things up screws up this mechanism a bit. That's why we do the 'git cherry-pick -x' which records the hash as a backup. git log --cherry-pick can help find changes to merge. There's been some scripts offered to also help find things... And usually when git cherry-pick doesn't produce working code, it's because other things weren't cherry-pucked that the code depends on. Sometimes you can find the changes to cherry-pick it, other times you have to do a manual fixup. Warner --00000000000082ccb205c3e7fa78--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfoiWB_X5LmqtBG3L7jf7z-_0aeia1d9eYbdLgzg9pSKMg>