[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gits] Git woes

Leigh Stoller <lbstoller@gmail.com> writes:

> I really don’t get it. All I am doing is working on a branch, merging in
> master every few days, and pushing that merged branch up. Do it all the
> time, and today it starts complaining, in a way gives me no clue as to what
> it thinks is really wrong.

I'm not sure that you are in fact just working on a branch (imageversion),
merging master into it, and pushing that branch up.

This is what you said you did:

> git stash
> git checkout master
> git fetch central
> git rebase central/master
> git checkout imageversion
> git rebase central/master

The last two commands would rebase your local imageversion branch onto
central/master.  That would lead to the situation I described in my previous
email, where your local imageversion branch and the central/imageversion branch
have no commits in common.  And that would lead to the symptom you described,
where you are unable to push your local imageversion branch to central:

> {1129} boss.utah$ git push central imageversion
> To git-public.flux.utah.edu:/flux/git/emulab-devel.git
>  ! [rejected]        imageversion -> imageversion (non-fast-forward)
> error: failed to push some refs to
> git-public.flux.utah.edu:/flux/git/emulab-devel.git'
> To prevent you from losing history, non-fast-forward updates were rejected

If instead, you had done this:

> git checkout imageversion
> git merge central/master # merge instead of rebase

Then I think your description would be accurate, that "all [you] am doing is
working on a branch, merging in master every few days, and pushing that merged
branch up."

> How do I get a set of diffs for all the changes I made since I branched?

This should give you all the changes on your local "imageversion" branch:

git diff central/master imageversion

But I'm not sure that this is what you really want (?), because if I understand
your tree, your imageversion branch would contain a lot of changes that are
also found in the central/imageversion branch.  Do you want to see those?

You could also do this:

git diff central/imageversion imageversion

But I'm not sure you want that, either, because that would include changes that
occurred along the master branch between the "branch points" of the two

If I understand your tree, I think that my previous advice is still relevant.
I would un-rebase your local imageversion branch.  Then you should be able to
merge central/master into it, and push the result up.

FWIW, I often use GitX to make sure that I understand the revision trees of git
repositories.  With GitX, it should be easy to see if your imageversion branch
really is different from central/imageversion.  If it is not, then clearly I
misunderstood the state of your repository, and you should ignore this message!


Eric Eide <eeide@cs.utah.edu>  .         University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX