平时使用gerrit管理代码的公司,软件开发人员经常会发现如果提交的代码不及时+2或者merge,如果有其他开发人员先于你merge(你们都是基于同于代码base), 那么你的代码将无法入库,出现merge conflict.

    本文将给出一种方法来解决这种问题:

- git remote update;

- git rev-parse xxx_branch |xargs git reset --hard

注:这里的xxx_branch需要替换为对应的代码分支

-  copy the cherry-pick line from gerrit page

 - git status //check the unmerged file and update it

出现冲突的情况,代码中会出现<<<<<<<<<< 和>>>>>>>>>>的结构快,需要删掉不需要的保留需要的即可。

- git add unmerged-file-name

- git cherry-pick --continue

- git push origin HEAD:refs/for/xxx_branch

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐