[Insight-developers] Gerrit for dummies (me)

Marcus D. Hanwell marcus.hanwell at kitware.com
Thu Apr 14 17:28:08 EDT 2011


On Thu, Apr 14, 2011 at 5:22 PM, Brad King <brad.king at kitware.com> wrote:
> On 04/14/2011 04:17 PM, Bill Lorensen wrote:
>> It happens to me every once in a while. I want to upload a new patch
>> to an existing topic. I do a git rebase -i HEAD~2 and squash the last
>> commit. I want the patch to show up with the original topic. Yes, I
>> know that I must delete the second change-id from the commit message.
>> But, sometimes I forget. So my patch shows up as a new gerrit topic.
>>
>> If this is a common mistake (maybe it's just me), then perhaps the
>> hook could refrain from adding the second change-id. Or maybe my use
>> case is bogus.
>
> Instead of
>
>  $ edit files
>  $ git add files
>  $ git commit
>  $ git rebase -i HEAD~2
>  $ git gerrit-push
>
> do
>
>  $ edit files
>  $ git add files
>  $ git commit --amend
>  $ git gerrit-push
>
Brad beat me to it, but this is exactly what you should be doing. No
second change id ever enters the picture then. This is why git commit
--amend exists, perhaps it should be added to an appropriate place in
the wiki as it is also quite a bit quicker than making a new commit
and then squashing it.

Marcus


More information about the Insight-developers mailing list