Ask Your Question
0

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

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

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? https://wiki.openstack.org/wiki/Gerrit_Workflow#Add_dependency (https://wiki.openstack.org/wiki/Gerri...) 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
1

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

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. https://help.github.com/articles/about-git-rebase#an-example-of-using-git-rebase (https://help.github.com/articles/abou...) . 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! 
tox 

# 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. https://ask.openstack.org/en/users/92/asalkeld/ (https://ask.openstack.org/en/users/92...)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

2 followers

Stats

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

Seen: 5,288 times

Last updated: Jun 20 '14