[Insight-developers] git gerrit-merge trouble
Cory Quammen
cquammen at cs.unc.edu
Wed Jul 27 10:09:10 EDT 2011
On Wed, Jul 27, 2011 at 9:55 AM, Brad King <brad.king at kitware.com> wrote:
> On 07/26/2011 05:55 PM, Cory Quammen wrote:
>> Hi,
>>
>> I'm trying to git gerrit-merge this patch:
>> http://review.source.kitware.com/#change,2089,patchset=6.
>>
>> I've rebased off the current master (as of this email):
>> http://www.itk.org/gitweb?p=ITK.git;a=commit;h=6646dbabff6fd1263fa105d016932d3f95f1f452
>>
>> So now 'git log -oneline' reports:
>>
>> 96ee95d ENH: Several enhancements for ConvolutionImageFilter
>> 6646dba Merge topic 'FixSignedInitializationWarning'
>> 0c632bf COMP: Removed signed initializer compiler warning
>> ...
>>
>> When I try 'git gerrit-merge', I get the error
>>
>> To git at itk.org:stage/ITK.git
>> ! [rejected] HEAD -> ConvolutionImageFilterEnhancements
>> (non-fast-forward)
>> error: failed to push some refs to 'git at itk.org:stage/ITK.git'
>> To prevent you from losing history, non-fast-forward updates were rejected
>> Merge the remote changes (e.g. 'git pull') before pushing again. See the
>> 'Note about fast-forwards' section of 'git push --help' for details.
>>
>> After rebasing on master, I'm not sure how this would not be a
>> fast-forward merge.
>>
>> I'm at a loss. Any ideas?
>
> The "gerrit-merge" alias is actually doing two things and neither
> one has anything to do with Gerrit. The name "gerrit-merge" was
> chosen because in the future it will hopefully be Gerrit that
> does the steps.
>
> First, it pushes your current HEAD to the ITK Topic Stage repository.
> There is already a branch called ConvolutionImageFilterEnhancements
> in the repository and you've rewritten it since the last time you
> tried to gerrit-merge. Therefore this push is a non-fast-forward
Thanks for the explanation, Brad.
> Second, gerrit-merge contacts the ITK Topic Stage repository through
> an ssh-based command-line interface. It asks the topic stage to
> compute the actual merge and push it to the real repository. You're
> not getting to this step because the first one fails to push.
>
> You can resolve this simply be force-pushing your branch to the
> topic stage:
>
> git push stage +HEAD
That worked! I didn't know about the + sign.
> I'm guessing that you tried gerrit-merge before, got conflicts,
> and then rebased on master to resolve them. The first time you should
> have seen instructions printed out about how to resolve the conflicts
> by merging master into your topic. By rebasing instead you wandered
> off the workflow for which the gerrit-merge alias was written.
Actually, at one point I accidentally ran 'git gerrit-merge' when I
meant 'git gerrit-push' and Ctrl-C'ed to prevent merging with master.
I'm sure that was a very bad thing to do, but probably less bad than
committing code that hadn't been approved. This must have created the
branch on the topic stage that eventually resulted in this
non-fast-forward business.
Thanks again,
Cory
--
Cory Quammen
Research Associate
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen
More information about the Insight-developers
mailing list