gerrit rebase review branch on latest changes from upstream branch

Viewed 5176

Is it possible to rebase topic branch with some changes pending review on upstream? I want to preserve all review comments, etc. but also have latest changes made in upstream.

I thought about following workflow (not sure if it works):

  • rebase local topic branch on latest changes from upstream;
  • force push new commits in local topic branch (without commits pushed to gerrit for review) to gerrit's refs/heads/thetopicbranch in order to replace commits in gerrit's branch with new changes from upstream;
  • push local topic branch head to gerrit for review, ie HEAD:refs/for/thetopicbranch - this will push changes that needs review and gerrit (I hope) match that commits with already pushed by their Change-Id.

The same, but in git commands (everything is done on local topic branch):

  • git rebase upstream
  • git push gerrit:project `git merge-base upstream localtopicbranch`:refs/heads/thetopicbranch -f
  • git push gerrit:project HEAD:refs/for/thetopicbranch

Will this schema work?

1 Answers
Related