How to amend review issues in Gerrit when there is a second newer review also

前端 未结 6 1828
梦毁少年i
梦毁少年i 2021-02-02 14:05

Still trying to learn how to use Gerrit and its process. Steps I did where

  1. Push first change1 to gerrit for review to HEAD:refs/for/develop
  2. W
6条回答
  •  独厮守ぢ
    2021-02-02 14:44

    I think your problem is related to the fact that the amendment to the 1st commit has the second commit as a dependency now. This is what I would personally do but there may be a better way. I look at it as you want to rebase the way your commits are and you are dealing with the last 3. So run 'git rebase -i HEAD~3'. This allows you to rebase the last 3 commits via switching the order or melding them to each other. You should be aware that it lists the commits in oldest-first order. Here's an example:

    git log is as follows:

    commit info:......

    message: foo2

    commit info:......

    message: bar1

    commit info:......

    message: foo1

    After running the above command an editor should pop up with the following:

    pick foo1.

    pick bar1.

    pick foo2.

    (This is assuming your second foo change didn't change any of the files that bar1 changed as this might not work and if you did do that you should have amended the commit anyway.) Then change the list to this:

    pick foo1

    fixup foo2

    pick bar1

    After that you will have foo1 and foo2 squashed into one commit and bar1 will be the commit following. Then I would run 'git reset --soft HEAD~1' resetting the newest commit, followed by a 'git commit --amend' which allows you to change the commit message for the first review and make sure to include the change-id. Then try your push. After that you should have a new patch set up, and all the files the second change was will be modified and still in your working directory.

提交回复
热议问题