[Insight-developers] git gerrit-merge trouble
Brad King
brad.king at kitware.com
Wed Jul 27 09:55:45 EDT 2011
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
so you get the error.
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
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.
-Brad
More information about the Insight-developers
mailing list