Re: git MFC/cherry-pick question
- In reply to: Alan Somers : "Re: git MFC/cherry-pick question"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Jun 2021 03:06:20 UTC
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