[vtk-developers] git help: 'git gerrit-push' fails with 'fatal: ref HEAD is not a symbolic ref'

Bill Lorensen bill.lorensen at gmail.com
Fri Aug 19 15:45:28 EDT 2011


Sean,

As you are discovering, with git, there are often several ways to do the
same thing.

Here is the workflow I use to creat and modify a gerrit topic that I want
reviewed:

git pullall
  I always like to make sure my changes will work on HEAD
git checkout -b MyGerritTopic
  Do all of my edting.
git add "the files I have changed"
git commit
  Add the appropriate commit message. In ITK we require special prefixes.
VTK does not require them.
git gerrit-push

Now I might return to master or another branch
git checkout master

Sometime later,
  Get the comments from reviewers.
git checkout MyGerritTopic
  Make the appropriate changes.
git add "the files I have changed"
git commit --amend
  This guarantees that the change-id will be the same.
git gerrit-push

Repeat as appropriate.

Bill




On Fri, Aug 19, 2011 at 3:32 PM, David Cole <david.cole at kitware.com> wrote:

> On Fri, Aug 19, 2011 at 3:30 PM, David Cole <david.cole at kitware.com>
> wrote:
> > On Fri, Aug 19, 2011 at 3:24 PM, Sean McBride <sean at rogue-research.com>
> wrote:
> >> On Fri, 19 Aug 2011 11:30:44 -0400, Utkarsh Ayachit said:
> >>
> >>>Do "git branch" and verify you are on a named branch.
> >>
> >> $ git branch
> >> * (no branch)
> >>  master
> >>  ply-code-review
> >>
> >> Indeed, I am somehow no longer on the right branch.  It wasn't me that
> changed it though!
> >>
> >> So I tried to switch:
> >>
> >> $ git checkout ply-code-review
> >> Warning: you are leaving 1 commit behind, not connected to
> >> any of your branches:
> >>
> >>  e88ef2c Additional code review of PLY code
> >>
> >> If you want to keep them by creating a new branch, this may be a good
> time
> >> to do so with:
> >>
> >>  git branch new_branch_name e88ef2cc25ba861da4d0b803c33defb13d36dc91
> >>
> >> Switched to branch 'ply-code-review'
> >>
> >> I guess the commit of improvements did not go onto the 'ply-code-review'
> branch?
> >>
> >> Thanks,
> >>
> >> --
> >> ____________________________________________________________
> >> Sean McBride, B. Eng                 sean at rogue-research.com
> >> Rogue Research                        www.rogue-research.com
> >> Mac Software Developer              Montréal, Québec, Canada
> >>
> >>
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtk-developers
> >>
> >>
> >
> > An easy and easy-to-understand way to keep that commit is by creating
> > a patch from it, and then applying the patch back onto the branch you
> > want it on:
> >
> > git format-patch -1
> >
> > git checkout ply-code-review
> > git am -3 0001-patch-name-here
> > rm 0001-patch-name-here
> >
> >
> > HTH,
> > David
> >
>
> Of course, that assumes that you're on the "(no branch)" commit still
> to get the right thing from the format-patch command...
>
> Before you make the patch you'll have to go back to that commit:
>
> git checkout e88ef2cc25ba861da4d0b803c33defb13d36dc91
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110819/d3878a74/attachment.html>


More information about the vtk-developers mailing list