Gerrit -- 已经push到网页的review如何解决merge conflict

方法一

  1. git remote update // 更新代码
  2. git rebase origin/branch // rebase发现冲突
  3. git status // 查看冲突
  4. 修改冲突
  5. git add [冲突文件]
  6. git rebase --continue // 继续rebase
  7. git push origin HEAD:refs/for/[branch] // 推送此次变更
    PS:git push origin HEAD:refs/drafts/[branch] // 推送至草稿箱

详见文章:http://tjtech.me/how-to-fix-merge-conflict-on-gerrit.html

方法二 (这个是按自己的理解做的,比较麻烦,因为不太清楚rebase的用法,方法一更简单

  1. git pull origin [branch] // 拉最新代码,发现冲突
  2. 修改冲突
  3. git add [冲突文件]
  4. git commit //此时会新生成一个commit id
  5. git rebase -i [commit_id] // 这里的commit_id是最原始版本, 比如未修改时版本为A, 修改了一版但是冲突的版本是B, 刚刚解决冲突的版本是C。 这里要输入A的版本号,意思是把BC合并起来
  6. git rebase --continue //如果有冲突,解决后执行这个命令
  7. git push origin HEAD:refs/for/[branch] //推送此次变更
原文地址:https://www.cnblogs.com/mooooonlight/p/13782116.html