[Insight-developers] Error when push second changes to gerrit

Marcus D. Hanwell marcus.hanwell at kitware.com
Sun Nov 21 10:37:16 EST 2010


On Nov 21, 2010, at 6:22 AM, wanlin wrote:

> When making changes in uploaded changes, i input
> git rebase -i HEAD~2
> 
> Two commits appear in the editor, i changed the second as edit
> 
> pick 18193dd Remove bug in NeighborhoodAlgorithm::ImageBoundaryFacesCalculator
> e 6bfb20c Remove bug in NeighborhoodAlgorithm::ImageBoundaryFacesCalculator
> 
> then ensure the second commit has the same change-ID with the first one. but when i push them

This sounds like you edited the commit messages so that both of the commits in your topic have the same Change-Id - is that what you did? If so, that is not correct. If you had the Gerrit hook activated you do not need to touch the Change-Id lines, if you didn't then each commit needs to match the Change-Id for that commit in Gerrit. This is why we strongly recommend that people activate these hooks if they weren't already activated (default in updated SetupForDevelopment.sh script).
> 
> git push gerrit HEAD:refs/for/master/NeighborhoodAlgorithm
> 
> It prompted the following error:
> 
>  ! [remote rejected] HEAD -> refs/for/master/NeighborhoodAlgorithm (squash commits first)
> error: failed to push some refs to 'wanlin at review.source.kitware.com:ITK'

This looks like you are trying to push a topic with two or more commits, that have the same Change-Id. That is why it is saying to squash first, you cannot have two different commits with the same Change-Id.

Just make the Change-Id for each commit match what is in Gerrit. In future, if you have the local Gerrit hook on you need never edit the Change-Id lines - they will be inserted for you after your local commit is created. You can edit, and then just repush to Gerrit.

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


More information about the Insight-developers mailing list