Re: first parent, commit graph layout, and pull merge direction

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

 



On Thu, May 23, 2013 at 02:01:39PM -0700, Junio C Hamano wrote:
> John Keeping <john@xxxxxxxxxxxxx> writes:
> 
> > I have to wonder how often "git pull" with no arguments actually does
> > what users really want (even if they don't know it!) when it doesn't
> > result in a fast-forward (and pull.rebase isn't configured).
> 
> If you are in a totally centralized shared repository mindset
> without using topic branch workflow, --first-parent would not help
> you.  In your history the second parent is more likely to be the
> mainline.
> 
> So for them "git pull" that either fast-forward when it can, or
> makes a merge that records the then-current state of the central
> shared repository, is perfectly sensible.  They will view gitk and
> see all the changes, "git shortlog" and "git log --no-merges" will
> give them what they expect.

Yes, but for people used to a cleaner history it's confusing to see the
mainline branch and one small change the wrong way round.  When I see
people doing this, it's normally something like:

    ... do some work for several hours...
    git commit -a
    git push
    # fails because it's not a fast forward
    git pull
    git push

In this scenario, just adding --rebase to "git pull" actually results in
a much more sensible history.

> > Hence my suggestion to error when "git pull" doesn't result in a
> > fast-forward and no branch name is specified.  We could give some advice
> > like:
> >
> >     Your local changes are not included in the local branch and you
> >     haven't told Git how to preserve them.
> >
> >     If you want to rebase your changes onto the modified upstream
> >     branch, run:
> >
> >         git pull --rebase
> 
> I can parse the first paragraph above, but cannot make much sense
> out of it.  Unless you are talking about local changes that are not
> committed yet, that is.  But in that case I fail to see what it has
> to do with the current discussion, or suggestion to use rebase.

This isn't about "swap parents", it's about helping people realise that
just "git pull" isn't necessarily the best thing for them to do, and
that they may want --rebase.

So I was asking if it would be sensible (possibly in Git 2.0) to make
git-pull pass --ff-only to git-merge by default.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]