我有一个Gerrit更改,它与master发生合并冲突,当我选择该更改时会说
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
我通常会在编辑器中打开冲突文件,解决冲突,然后将更改上传到gerrit(它会被修改),但是如何使用脚本进行变基,因此它总是从选择的gerrit中选择更改(覆盖本地存在的任何内容(通常是主版本),因此我可以上传Gerrit更改而无需人工干预?这是我想做的事:
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.
答案 0 :(得分:1)
您应该可以force a cherry-pick resolution使用
git cherry-pick <sha> --strategy-option theirs
git cherry-pick <sha> -X theirs
这样,您可以将该步骤集成到脚本中,然后可以在无人参与的情况下运行该脚本。