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
  • 2,759
  • 2
  • 32
  • 55

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,129,465
  • 480
  • 4,036
  • 4,755