How to solve merge conflict in a approved review in gerrit?

Arshak Anj picture Arshak Anj · Nov 8, 2018 · Viewed 8.6k times · Source

I made a change in gerrit which was code reviewed and after 7 revisions approved. But, now it cannot be merged and trying to rebase in gerrit website is not working due to merge conflict. How can I resolve this merge conflict and merge the same approved change and not create a new one. (Full steps from cloning the repo would be appreciated.)

Answer

1) Clone the Gerrit repository

git clone https://USER@GERRIT-SERVER/a/REPO-FULL-PATHNAME

2) Go to the change page on Gerrit and copy the checkout patch command

git fetch https://USER@GERRIT-SERVER/a/REPO-FULL-PATHNAME refs/changes/XX/YYYYY/Z && git checkout FETCH_HEAD

3) Rebase the change

git rebase origin/BRANCH

4) Solve the conflicts

git mergetool

5) Continue the rebase

git rebase --continue

Repeat the steps 4 and 5 until the end of conflicts

git commit --amend

Note: Keep the same Change-Id

6) Send the new patchset to Gerrit

git push origin HEAD:refs/for/BRANCH