Cause:
在Gerrit等待code review通過期間,若有協同開發者先merge commit,且該commit和自己的commit
發生衝突的情況
Solution:
1.
在發生conflict
的 branch上
執行
git pull --rebase origin master
此指令說明如下
This
command will fetch new commits from the remote and then rebase your
local commits on top of them. It will temporarily set aside the
changes you've made in your branch, apply all of the changes that
have happend in master to your working branch, then merge (recommit)
all of the changes you've made back into the branch. Doing this will
help avoid future merge conflicts. Plus, it gives you an opportunity
to test your changes against the latest code in master.
Once
you are satisfied with your change set and you've rebased against
master, you are ready to push your code to Gerrit for review.
簡單的說:把master上已合併的commit(但在目前branch不存在),接到目前的branch上,再把
目前branch的commit接到最後面(最新)
當然在Gerrit網頁上合併會發生衝突,所以執行這個指令之後在本地端也會發生衝突,把執行後的提示紀錄下來如下
When
you...