声明:
本博客欢迎转发,但请保留原作者信息!
博客地址:http://blog.csdn.net/llg8212
内容系本人学习、研究和总结,如有雷同,不胜荣幸!
当代码core view后,就会被合到主干代码。由于很多人同时在修改代码,所以merge时可能会存在代码冲突的情况。当出现如下信息时,就说明你的代码和主干代码有冲突了。
Doesn't seem to work
Build failed. For information on how to proceed, seehttps://wiki.openstack.org/
This change was unable to be automatically merged with the currentstate of the repository. Please rebase your change and upload a newpatchset.
解决办法:
git checkout master
git fetch --all # Fetch all remotes
git reset --hard origin/master # Resets the index and working
tree. Any changes to tracked files
in the working tree since <commit> are discarded。
git review -d <patchNumber> # patchNumber为提patch时生成的数字串,
git rebase master # If <branch> is specified, git
rebase will perform an automatic git
checkout <branch> before doing anything else. Otherwise it remains on
the current branch.
这时就将主干的代码合入到本地了,通过git status就能看到修改的内容和冲突的文件。如:
# Not currently on any branch.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: glance/api/v2/image_data.py
# modified: glance/api/v2/image_members.py
# modified: glance/api/v2/image_tags.py
# modified: glance/api/v2/images.py
# modified: glance/store/gridfs.py
# modified: glance/store/rbd.py
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: glance/store/cinder.py
#
解决完冲突后,测试用例运行正常,再提交代码。
$ git add 注:必须使用git add命令,而不能使用git commit -a来提交
$ git rebase --continue
注:使用git rebase --continue后,用git status查看有时会发现当前不在任何分支上,这时需要再执行一次 git rebase --continue。
$ git review -R
但是比较郁闷的是,两个core review就泡汤了。但如果用例正常通过,很快能再被core review。
注:使用git review -d <patchNumber>可以直接从review下载review的代码到本地。