[Insight-developers] How to update a gerrit patch with automatic Change-Id

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Aug 30 14:22:09 EDT 2010


Hello,

Thanks Brad, this made it much smoother.

In case anyone is following at home trying to figure this stuff out. I had a topic in gerrit consisting of multiple commits. Through the power of gerrit review, Luis fortunately found a mistake in one of my commit before it was merged into master. This required me to edit a commit in history and re push the branch into gerrit. After a couple of miss-teps, here is how to update a gerrit patch:

# utilize gerrit hook to automatically add a Change-Id
git config hooks.GerritId true

# Switch to branch to be reviewed
git checkout jpeg2000io_review

# use interactive rebase to go back the number of commits needed
git rebase -i HEAD~4

edit your mistake

# add the file and ammend the commit
# note the Change-ID line will not show up here, it will be appended during the commit
git commit --amend your_updated_file
# verify the change-ID was added
git log 
git rebase --continue

# repeat applying amend and continue to add change IDs
git commit --amend
git rebase --continue

# check the change-ids
git log

# push the changes back into gerrit
git push gerrit HEAD:refs/for/master/jpeg2000io_review


Hope people find this useful.

I'll add it to:
http://www.itk.org/Wiki/ITK/Gerrit

Brad L.

On Aug 30, 2010, at 1:36 PM, Brad King wrote:

> On 08/30/2010 12:02 PM, Brad King wrote:
>> Last week I started on changes to our hooks branch to include
>> Gerrit's hook but have not finished yet.
> 
> I just finished it and pushed this out:
> 
>  http://itk.org/gitweb?p=ITK.git;a=log;h=cb038d0b
> 
> Update your hooks and run
> 
>  git config hooks.GerritId true
> 
> to enable the feature.
> 
> -Brad K

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100830/b5620604/attachment.htm>


More information about the Insight-developers mailing list