Gerrit: best way to make a series of dependent commits?

asked 2014-06-06 17:18:34 -0600

dzimine gravatar image

A basic git/gerrit question:

I want to do a large blueprint implementation as a series of dependent changes, to post them on the review separately. There will be reviews on changes in arbitrary order, I'll need to respond and send patches for each change.

What's the best way to do it?

Do I make a series of commits on the topic branch, than post them to review as a bunch? Than how can I than post a patch on a given change in a series?

Or do I chain them as dependencies, as if were someone else's? as described on the wiki? ( This feels like overkill...

How do you guys do this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-20 00:55:43 -0600

dzimine gravatar image

Figured this out. The answer is "Become a master of Git rebase"

git rebase -i master

Git will open the editor with the list of the commits, and the available commands. ( . Put 'edit' on the changes you want to update. Git will stop you at the commits and let you amend them and continue when you're done.

# edit the code
# when you happy, add your changes to the commit

git commit --amend
# yes, run your tests! 

# continue to the next change
git rebase --continue

If things go wrong, git rebase --abort will let you start over. When rebase successful, post the amended chain of changes to Gerrit:

git review

it will show the list of changes and asks if this is what you intended. Say 'yes'

At this point, Gerrit posts a new patch on each amended commit. It may post a patch on others if needed, but don't worry about it: the reviews and +1 +2 on those unedited changes will remain.

Thanks Angus Salkeld asalkeld for walking me through this. (

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2014-06-06 17:18:34 -0600

Seen: 7,125 times

Last updated: Jun 20 '14