Missing dependency in Gerrit

后端 未结 3 1140
野趣味
野趣味 2021-01-06 16:34

I had four changes in Gerrit, each depending on previous one (except first, of course). I\'ve abandoned second and third and reviewed first and fourth. Since first wasn\'t d

3条回答
  •  执笔经年
    2021-01-06 17:13

    Ok, here is my revised answer

    Starting point is where you have your 4 commits in a row:

    #git log --graph --decorate --oneline
    * 448fd95 (HEAD, master) Change 4
    * 3950f5f Change 3
    * 8753adf Change 2
    * cdcfe20 Change 1
    

    Next, create a temp branch from the head

    #git branch temp
    #git log --graph --decorate --onelin
    * 448fd95 (HEAD, temp, master) Change 4
    * 3950f5f Change 3
    * 8753adf Change 2
    * cdcfe20 Change 1
    

    Now you need to reset your master to get rid of the unwanted history:

    #git reset --hard cdcfe20
    HEAD is now at cdcfe20 Change 1
    #git log --graph --decorate --oneline
    * cdcfe20 (HEAD, master) Change 1
    

    Cherry pick your change 4 into the master

    #git cherry-pick 448fd95
    [master 19c5ba1] Change 4
     1 file changed, 1 insertion(+), 1 deletion(-)
    #git log --graph --decorate --oneline
    * 19c5ba1 (HEAD, master) Change 4
    * cdcfe20 Change 1
    

    Now you can push the last change to gerrit and your dependencies are fixed

提交回复
热议问题