1

I have a gerrit change which has merge conflict with master, when I cherry-pick the change, it says

error: could not apply 0819af2... Test change
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
# now git status is as below...
$ git status
## master...origin/master
UU path/to/file

I usually open the conflict file in a editor, resolve the conflict and upload the change to gerrit (it gets amended), but how to do the rebase using script so it always picks the change from gerrit being cherry-picked (overwrite whatever is present locally - usually the master), so I can upload the gerrit change without manual intervention? here is what I like to do:

git clone a project
apply the gerrit# 1234, if there is conflict, pick the changes from change #1234, overwriting whatever is cloned in current working dir.
Amend the gerrit, so it is rebased now.
rodee
  • 3,233
  • 5
  • 34
  • 70

1 Answers1

1

You should be able to force a cherry-pick resolution with

git cherry-pick <sha> --strategy-option theirs
git cherry-pick <sha> -X theirs

That way, you can integrate that step in a script which can then run unattended.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250