git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pull is Mostly Evil
@ 2014-05-02 15:37 Marc Branchaud
  2014-05-02 15:45 ` David Kastrup
                   ` (3 more replies)
  0 siblings, 4 replies; 50+ messages in thread
From: Marc Branchaud @ 2014-05-02 15:37 UTC (permalink / raw)
  To: Git Mailing List


(Apologies for not CCing all the folks who've participated in the "Pull is
Evil" thread -- I couldn't find a good branch of that thread for this message.)

OK, so maybe "git pull" is just Mostly Evil.  People seem to have found many
different ways to make it work for them.

But in reality "git pull" has become a chimera that confuses a large number
of new users, and that experienced users either avoid entirely or customize
to give them a convenient shorthand for working in their particular
environment.  As a tool for new git users, it just doesn't seem to be
achieving its goals.

I think the git project as a whole would benefit if it started to treat "git
pull" as an advanced command, in the sense that it needs to be configured by
an experienced user in order to make it correctly follow a project's
workflow.  Once it's configured properly, "git pull" is a powerful tool that
gives users an easy way to do complex things.  In that sense, it may be
appropriate for a project to tailor "git pull" as it likes, then teach its
own users to use the command.

However, when it comes to teaching people how to use git qua git, "git pull"
should be the last thing they learn about, because it's only after you
understand various basic git concepts that you can configure "git pull" to do
the right thing.

To that end, I suggest that pull's default behaviour should be to do
*nothing*.  It should just print out a message to the effect that it hasn't
been configured, and that the user should run "git help pull" for guidance.

It'll take quite a bit of time, but I think that if we change our attitude
towards "git pull" and take this unconfigured-by-default approach, then in a
few years the entire git ecosystem will be in a better place.

		M.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 15:37 Pull is Mostly Evil Marc Branchaud
@ 2014-05-02 15:45 ` David Kastrup
  2014-05-02 16:05   ` Philip Oakley
  2014-05-02 19:31   ` David Lang
  2014-05-02 18:13 ` Junio C Hamano
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 50+ messages in thread
From: David Kastrup @ 2014-05-02 15:45 UTC (permalink / raw)
  To: git

Marc Branchaud <marcnarc@xiplink.com> writes:

> To that end, I suggest that pull's default behaviour should be to do
> *nothing*.  It should just print out a message to the effect that it
> hasn't been configured, and that the user should run "git help pull"
> for guidance.

Fetching is uncontentious, and I _think_ that fast-forwards are pretty
uncontentious as well.

It's just when the merge-left/merge-right/rebase-left/rebase-right
decision kicks in that prescribing one git-pull behavior looks like a
recipe for trouble.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 15:45 ` David Kastrup
@ 2014-05-02 16:05   ` Philip Oakley
  2014-05-02 19:05     ` Felipe Contreras
  2014-05-02 19:31   ` David Lang
  1 sibling, 1 reply; 50+ messages in thread
From: Philip Oakley @ 2014-05-02 16:05 UTC (permalink / raw)
  To: git, David Kastrup

From: "David Kastrup" <dak@gnu.org>
> Marc Branchaud <marcnarc@xiplink.com> writes:
>
>> To that end, I suggest that pull's default behaviour should be to do
>> *nothing*.  It should just print out a message to the effect that it
>> hasn't been configured, and that the user should run "git help pull"
>> for guidance.
>
> Fetching is uncontentious, and I _think_ that fast-forwards are pretty
> uncontentious as well.

While the fast forward is /pretty/ uncontentious, it still maybe 
contentious for some. But more importantly (in my mind) is the fact that 
it (git pull) hasn't been configured, and pressing for _that_ to happen 
is the big benefit.

I'm more than happy that the fast-forward should be the recommended 'if 
you don't know, choose this' option, as you say, its pretty 
uncontentious and has easy mechanisms for backing out which are well 
illustrated across the internet.

It would still need a few cycles of ramping up the warnings to ease folk 
in gently. One has to beware of the issues at both ends of the Kruger 
Dunning curve. This thread discussion in some ways has suffered from the 
inverse K-D effect.

>
> It's just when the merge-left/merge-right/rebase-left/rebase-right
> decision kicks in that prescribing one git-pull behavior looks like a
> recipe for trouble.
>
> -- 
> David Kastrup
>
--
Philip

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 15:37 Pull is Mostly Evil Marc Branchaud
  2014-05-02 15:45 ` David Kastrup
@ 2014-05-02 18:13 ` Junio C Hamano
  2014-05-02 19:11   ` Felipe Contreras
                     ` (2 more replies)
  2014-05-02 22:12 ` Philip Oakley
  2014-05-09 19:49 ` Marc Branchaud
  3 siblings, 3 replies; 50+ messages in thread
From: Junio C Hamano @ 2014-05-02 18:13 UTC (permalink / raw)
  To: Marc Branchaud; +Cc: Git Mailing List

Marc Branchaud <marcnarc@xiplink.com> writes:

> (Apologies for not CCing all the folks who've participated in the "Pull is
> Evil" thread -- I couldn't find a good branch of that thread for this message.)
>
> OK, so maybe "git pull" is just Mostly Evil.  People seem to have found many
> different ways to make it work for them.
>
> But in reality "git pull" has become a chimera that confuses a large number
> of new users, and that experienced users either avoid entirely or customize
> to give them a convenient shorthand for working in their particular
> environment.  As a tool for new git users, it just doesn't seem to be
> achieving its goals.
>
> I think the git project as a whole would benefit if it started to treat "git
> pull" as an advanced command, in the sense that it needs to be configured by
> an experienced user in order to make it correctly follow a project's
> workflow.  Once it's configured properly, "git pull" is a powerful tool that
> gives users an easy way to do complex things.  In that sense, it may be
> appropriate for a project to tailor "git pull" as it likes, then teach its
> own users to use the command.
>
> However, when it comes to teaching people how to use git qua git, "git pull"
> should be the last thing they learn about, because it's only after you
> understand various basic git concepts that you can configure "git pull" to do
> the right thing.
>
> To that end, I suggest that pull's default behaviour should be to do
> *nothing*.  It should just print out a message to the effect that it hasn't
> been configured, and that the user should run "git help pull" for guidance.
>
> It'll take quite a bit of time, but I think that if we change our attitude
> towards "git pull" and take this unconfigured-by-default approach, then in a
> few years the entire git ecosystem will be in a better place.

Your earlier long-hand, together with the two examples that pulls
into the same "maint" branch Brian gave us, may give us a better
starting points to think about a saner way.

To me, the problem sounds like:

    Tutorials of Git often says "use 'git pull' to catch up your
    branch with your upstream work and then 'git push' back" (and
    worse yet, 'git push' that does not fast-forward suggests doing
    so), but 'git pull' that creates a merge in a wrong direction is
    not the right thing for many people.

And proposed solutions range from "let's write 'pull' off as a
failed experiment" to "let's forbid any merge made by use of 'pull'
by default, because it is likely that merge may be in reverse".

Let's look at Brian's examples, which may point at a good direction.

When he becomes in charge of producing a new 'maint' (in his
original, he says 'maintenance-branch'), he first does this:

    $ git checkout maint
    $ git pull --ff-only [ origin maint ]

He may have a stale 'maint' branch for a variety of reasons.  He may
have been the pumpking in the past, worked on his local 'maint' to
advance its tip with merges in the right direction and pushed the
result out to the central repository when he was done, and kept that
then-current 'maint' in his repository without removing when he
passed the pumpkin to somebody else.  As you said in the thread,
this could have been done on a detached head, but keeping the local
branch around is more convenient (you may want to do a disconnected
development and having a reference point is handy).  Or he may be
the long-term pumpking for 'maint' branch, but is working on a
machine different from the one he updated the shared 'maint' the
last time.

In either case, what is most important for this 'pull' is that he is
catching up with today's central repository, without losing any old
work that he forgot to push out when he was playing the pumpking the
last time (hence --ff-only to cause it to fail if that is the case)
in this local repository.

Then he integrates a topic by another and push the result with:

    $ git pull [--no-ff] developer-remote topic-branch
    $ git push [ origin maint ]

For this 'pull', he knows that this may not fast-forward (the
$DAYJOB convention to use a real merge even when the merge
fast-forwards is optional).

Even with the proposed "pull.mode" or "branch.maint.pullmode", these
two 'pull' cannot be given a convenient default.  The best we can do
with the approach is to set pull.mode to ff-only for safety to protect
his first 'pull' from the origin/maint, and have him remember to
override it from the command line with "--merge --no-ff" [*1*].

If we step back a bit, because we are forcing him to differentiate
these two pulls in his mental model anyway, perhaps it may help
people (both new and old) if we had a new command to make the
distinction stand out more.  What if the command sequence were like
this instead?

    $ git checkout maint
    $ git update [ origin maint ]

    $ git pull [--no-ff] developer-remote topic-branch
    $ git push [ origin maint ]

where the new command 'update' enforces the '--ff-only' update.  And
then we would stop telling "'git pull' first" when a push does not
fast-forward.

Stepping back even further, and thinking what is different between
these two pulls, we notice that the first one is pulling from the
place we push back to.  Perhaps a way to solve this issue, without
having to introduce a new 'git update' and updating the tutorials,
may be disallow fetch+merge by default only when pulling from the
place the result is going to be pushed back to?  That is one case in
which it is very clear that we are making a merge in the wrong
direction.  When you are pulling from developer-remote that is not
where you are going to push back, is there a reason to forbid a
non-ff pull from creating a merge?

Also I think what you said in a separate subthread merits more
thought:

    What's more, it seems to me that the only real advantage "git
    pull" provides here is a less typing compared to the non-pull
    equivalent:

      git fetch main-repo
      git checkout main-repo/maintenance-branch
      git fetch developer-remote
      git merge --no-ff developer-remote/topic-branch
      git push main-repo HEAD

    I suggest that this approach is superior for new users (despite
    the increased risk of finger cramps), because if main-repo's
    maintenance-branch is updated in the interim and the push fails,
    the user can use the exact same commands to resolve the
    situation.

I very much like the "you can easily tell the new person to redo the
whole thing when the last push does not fast-forwareed" aspect of
this approach.  Maybe a good alternative may be to encapsulate this
sequence to a handy "git update" (which is *NOT* the one I suggested
off-the-cuff in the above to replace the first 'git pull' in Brian's
example---it is more for the second one) wrapper and promote the use
of that in our tutorials.  Perhaps:

    $ git checkout maint
    $ git update developer-remote topic-branch
    $ git push [ origin maint ]

that tells us to fast-forward update the current branch (maint) from
its upstream (origin), fetch the developer's work and merge it.
When the last 'push' does not fast-forward, that has to be because
somebody else pushed (because we already made it up-to-date), so the
second time around, "git update" that notices that it cannot
fast-forward can offer to recreate the merge (or any further work
done since the local 'maint' diverged from the origin/maint), before
redoing the "git pull developer-remote topic-branch" phase.

A hypothetical transcript might go like this.

    $ git checkout maint
    $ git update developer-remote topic-branch
       ... does a rough equivalent of
       $ git pull --ff-only [ origin maint ]
       $ git pull [--no-ff] developer-remote topic-branch
    $ git push [ origin maint ]
    error: the push does not fast-forward.  "git update" before
    error: attempting to push again.

    $ git update
      ... internally does:
      $ git pull --ff-only [ origin maint ]
      ... which fails due to --ff-only
    info: You have some local work made on an old version of
    info: origin/maint.  Let's rebuild it on top of the latest.
      ... does a rough equivalent of
      $ git rebase --preserve-merges origin/maint

    $ git push [ origin maint ]
    ... this time it succeeds.

Note that this would also support, without any change, those who
build their own changes directly on top of their 'master' and push
the result back to the shared 'master'.

And to guard new people who type 'pull' when they meant 'update', 
we can notice if the pull is coming from the same place origin/maint
we will push back to.

Hmm?


[Footnote]

*1* I do not think it is *wrong* to say "we won't differentiate
    these two modes; if somebody pulls into the same branch this
    way, he is an integrator and should know better than newbies who
    gets harmed by a merge in the wrong direction" and stop our
    effort at this point.  I would say that is perfectly a valid
    position to take, as long as it is clearly documented: in order
    to help majority of new people, experienced ones are asked to do
    X and Y that they did not have to.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 16:05   ` Philip Oakley
@ 2014-05-02 19:05     ` Felipe Contreras
  2014-05-02 22:34       ` Philip Oakley
  0 siblings, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-02 19:05 UTC (permalink / raw)
  To: Philip Oakley, git, David Kastrup

Philip Oakley wrote:
> From: "David Kastrup" <dak@gnu.org>
> > Marc Branchaud <marcnarc@xiplink.com> writes:
> >
> >> To that end, I suggest that pull's default behaviour should be to do
> >> *nothing*.  It should just print out a message to the effect that it
> >> hasn't been configured, and that the user should run "git help pull"
> >> for guidance.
> >
> > Fetching is uncontentious, and I _think_ that fast-forwards are pretty
> > uncontentious as well.
> 
> While the fast forward is /pretty/ uncontentious, it still maybe 
> contentious for some.

So? No defaults can please absolutely everyone, the best anybody can do
is try to please the majority of people, and merging fast-forwards only
does that.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 18:13 ` Junio C Hamano
@ 2014-05-02 19:11   ` Felipe Contreras
  2014-05-02 20:06     ` Junio C Hamano
  2014-05-02 21:48     ` Jeff King
  2014-05-03  7:56   ` Richard Hansen
  2014-05-03 10:00   ` John Szakmeister
  2 siblings, 2 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-02 19:11 UTC (permalink / raw)
  To: Junio C Hamano, Marc Branchaud; +Cc: Git Mailing List

Junio C Hamano wrote:
> If we step back a bit, because we are forcing him to differentiate
> these two pulls in his mental model anyway, perhaps it may help
> people (both new and old) if we had a new command to make the
> distinction stand out more.  What if the command sequence were like
> this instead?
> 
>     $ git checkout maint
>     $ git update [ origin maint ]
> 
>     $ git pull [--no-ff] developer-remote topic-branch
>     $ git push [ origin maint ]
> 
> where the new command 'update' enforces the '--ff-only' update.  And
> then we would stop telling "'git pull' first" when a push does not
> fast-forward.

In addition to barf when it's not a fast-forward, such command can
switch the parents, so it appears 'maint' was merged to 'origin/maint'.
Many people have complained about this order.

> Stepping back even further, and thinking what is different between
> these two pulls, we notice that the first one is pulling from the
> place we push back to.  Perhaps a way to solve this issue, without
> having to introduce a new 'git update' and updating the tutorials,
> may be disallow fetch+merge by default only when pulling from the
> place the result is going to be pushed back to?

Which is basically essentially the same as not specifying anything, or
rather, running `git pull` without arguments.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 15:45 ` David Kastrup
  2014-05-02 16:05   ` Philip Oakley
@ 2014-05-02 19:31   ` David Lang
  2014-05-02 19:37     ` David Kastrup
  1 sibling, 1 reply; 50+ messages in thread
From: David Lang @ 2014-05-02 19:31 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

On Fri, 2 May 2014, David Kastrup wrote:

> Date: Fri, 02 May 2014 17:45:23 +0200
> From: David Kastrup <dak@gnu.org>
> To: git@vger.kernel.org
> Subject: Re: Pull is Mostly Evil
> 
> Marc Branchaud <marcnarc@xiplink.com> writes:
>
>> To that end, I suggest that pull's default behaviour should be to do
>> *nothing*.  It should just print out a message to the effect that it
>> hasn't been configured, and that the user should run "git help pull"
>> for guidance.
>
> Fetching is uncontentious, and I _think_ that fast-forwards are pretty
> uncontentious as well.

so those people just need to use fetch instead of pull.

This seems fairly straightforward

fetch, get the data but don't integrate it

pull, get the data and ff along it if possible

pull with options, merge/rebase left/right based on options when ff is not 
possible.

Pull was created with one workflow in mind, Changing it to require explcitly 
specifying the option (in a config, with appropriate transition, handholding) is 
not completly unreasonable, and given the confusion this causes, may be very 
reasonable.

But saying that ff isn't always right, so make pull go away altogether (or 
"don't change anything because there isn't 100% agreement on the result" 
paralysis) doesn't seem right.

> It's just when the merge-left/merge-right/rebase-left/rebase-right
> decision kicks in that prescribing one git-pull behavior looks like a
> recipe for trouble.

confusion at least. It's not fatal confusion, people have been using it for 
years after all.

David Lang

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 19:31   ` David Lang
@ 2014-05-02 19:37     ` David Kastrup
  0 siblings, 0 replies; 50+ messages in thread
From: David Kastrup @ 2014-05-02 19:37 UTC (permalink / raw)
  To: David Lang; +Cc: git

David Lang <david@lang.hm> writes:

> On Fri, 2 May 2014, David Kastrup wrote:
>
>> It's just when the merge-left/merge-right/rebase-left/rebase-right
>> decision kicks in that prescribing one git-pull behavior looks like a
>> recipe for trouble.
>
> confusion at least. It's not fatal confusion, people have been using
> it for years after all.

It's one of the most frequent causes for educating newcomers what they
have been doing wrong in the LilyPond project.  Including the occasional
blunder from experienced people who did not notice that they got a
non-ff merge as a mergeday present.

It's one of the main things putting new contributors on edge and causing
anxiety about messing up again.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 19:11   ` Felipe Contreras
@ 2014-05-02 20:06     ` Junio C Hamano
  2014-05-02 20:58       ` Felipe Contreras
  2014-05-02 21:48     ` Jeff King
  1 sibling, 1 reply; 50+ messages in thread
From: Junio C Hamano @ 2014-05-02 20:06 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Marc Branchaud, Git Mailing List

Felipe Contreras <felipe.contreras@gmail.com> writes:

>> Stepping back even further, and thinking what is different between
>> these two pulls, we notice that the first one is pulling from the
>> place we push back to.  Perhaps a way to solve this issue, without
>> having to introduce a new 'git update' and updating the tutorials,
>> may be disallow fetch+merge by default only when pulling from the
>> place the result is going to be pushed back to?
>
> Which is basically essentially the same as not specifying anything, or
> rather, running `git pull` without arguments.

I cannot tell if you are agreeing or disagreeing, and with what.

Using the "special case 'git pull' without arguments" heuristics
would take us back to the old jc/pull-training-wheel patch

    http://thread.gmane.org/gmane.comp.version-control.git/225146/focus=230856

which we agreed to drop in

    http://thread.gmane.org/gmane.comp.version-control.git/233554/focus=234365

to favor the old series you did with pull.mode, and we rejected that
patch in $gmane/230856 for a sound reason, I would think.

"You are pulling from the place the result is going to be pushed
back to" is different from "'git pull' was run without arguments".
In the "pumpking" example in the message you are responding to:

    When he becomes in charge of producing a new 'maint' (in his
    original, he says 'maintenance-branch'), he first does this:

        $ git checkout maint
        $ git pull --ff-only [ origin maint ]

the heuristics would trigger the safety only when the optional
"origin maint" are not given, but we do have enough information
to see "git pull origin maint" (with where from and what to pull
explicitly specified on the command line) falls into the case where
the user needs protection, don't we?

Also, with the triangular push configuration, "git pull" without
argument will fetch from one place that is different from where the
current branch is going to pushed to, so that heuristics would not
work at all.

So...

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 20:06     ` Junio C Hamano
@ 2014-05-02 20:58       ` Felipe Contreras
  0 siblings, 0 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-02 20:58 UTC (permalink / raw)
  To: Junio C Hamano, Felipe Contreras; +Cc: Marc Branchaud, Git Mailing List

Junio C Hamano wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
> 
> >> Stepping back even further, and thinking what is different between
> >> these two pulls, we notice that the first one is pulling from the
> >> place we push back to.  Perhaps a way to solve this issue, without
> >> having to introduce a new 'git update' and updating the tutorials,
> >> may be disallow fetch+merge by default only when pulling from the
> >> place the result is going to be pushed back to?
> >
> > Which is basically essentially the same as not specifying anything, or
> > rather, running `git pull` without arguments.
> 
> I cannot tell if you are agreeing or disagreeing, and with what.

I'm agreeing that 'git pull repo branch' is different than 'git pull',
and 'git pull' is the problem. I'm not certain about 'git pull repo',
but I think that probably shouldn't change either.

> Using the "special case 'git pull' without arguments" heuristics
> would take us back to the old jc/pull-training-wheel patch
> 
>     http://thread.gmane.org/gmane.comp.version-control.git/225146/focus=230856

If you mean adding back the 'test $# = 0', then yes, if you mean going
back to 'pull.rebase=false' to force merges (and a bunch of other
stuff), then no.

> which we agreed to drop in
> 
>     http://thread.gmane.org/gmane.comp.version-control.git/233554/focus=234365
> 
> to favor the old series you did with pull.mode, and we rejected that
> patch in $gmane/230856 for a sound reason, I would think.

Because the 'pull.mode=merge' mode option was simply sensible.

> "You are pulling from the place the result is going to be pushed
> back to" is different from "'git pull' was run without arguments".
> In the "pumpking" example in the message you are responding to:
> 
>     When he becomes in charge of producing a new 'maint' (in his
>     original, he says 'maintenance-branch'), he first does this:
> 
>         $ git checkout maint
>         $ git pull --ff-only [ origin maint ]
> 
> the heuristics would trigger the safety only when the optional
> "origin maint" are not given, but we do have enough information
> to see "git pull origin maint" (with where from and what to pull
> explicitly specified on the command line) falls into the case where
> the user needs protection, don't we?

I think 'git pull' and 'git pull origin maint' are different, regardless
of the fact that origin/maint is the upstream.

In the former I would expect 'maint' to be merged to 'origin/maint', in
the latter I would expect 'origin/maint' to be merged into 'maint'. And
if the user has specified that he wants to merge 'origin/maint' into
'maint', I don't see why a non-fast-forward should fail.
 
> Also, with the triangular push configuration, "git pull" without
> argument will fetch from one place that is different from where the
> current branch is going to pushed to, so that heuristics would not
> work at all.

I think that's irrelevant. Both the upstream and publish tracking
branches don't matter when the user has specifically asked for a branch
to be pulled.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 19:11   ` Felipe Contreras
  2014-05-02 20:06     ` Junio C Hamano
@ 2014-05-02 21:48     ` Jeff King
  2014-05-02 21:55       ` Felipe Contreras
                         ` (2 more replies)
  1 sibling, 3 replies; 50+ messages in thread
From: Jeff King @ 2014-05-02 21:48 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

On Fri, May 02, 2014 at 02:11:05PM -0500, Felipe Contreras wrote:

> Junio C Hamano wrote:
> > If we step back a bit, because we are forcing him to differentiate
> > these two pulls in his mental model anyway, perhaps it may help
> > people (both new and old) if we had a new command to make the
> > distinction stand out more.  What if the command sequence were like
> > this instead?
> > 
> >     $ git checkout maint
> >     $ git update [ origin maint ]
> > 
> >     $ git pull [--no-ff] developer-remote topic-branch
> >     $ git push [ origin maint ]
> > 
> > where the new command 'update' enforces the '--ff-only' update.  And
> > then we would stop telling "'git pull' first" when a push does not
> > fast-forward.
> 
> In addition to barf when it's not a fast-forward, such command can
> switch the parents, so it appears 'maint' was merged to 'origin/maint'.
> Many people have complained about this order.

I realize this has veered off into talking about an "update" command,
and not necessarily "pull", but since there a lot of proposals floating
around, I wanted to make one point: if we are going to do such a switch,
let's please make it something the user explicitly turns on.

One common workflow for GitHub users is to back-merge master into a
topic, because they want the final "integrated" version on the topic
branch. That lets it get review, run tests, and even get test-deployed
from there before merging to master (and then when it does merge to
master, we know the result will be a trivial merge).  This workflow
helps spread out the load (there is no central "integration" person or
script, and the merge itself becomes a possible part of the review/test
cycle).  Some projects will do this by rebasing the topic, but that has
its own complications (like making collaboration harder because the
commits are being frequently rewritten).

Such users are going to run "git pull origin master" or just "git pull"
to get that merge. A switch to disallowing non-ff is going to disrupt
that workflow.  I think we can live with that, as they should be able to
stop and say "no, my workflow wants these merges", set a config
variable, and be done.

But I think that is the same moment they should probably be deciding on
whether their workflow wants "regular" or "reverse" merges. And I do not
think the decision between the two has an obvious split over which is
better. So it makes sense to me to take the opportunity when the user is
thinking about their workflow to have them specify one or the other.

-Peff

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 21:48     ` Jeff King
@ 2014-05-02 21:55       ` Felipe Contreras
  2014-05-02 22:36         ` Jeff King
  2014-05-03  2:18       ` David Kastrup
  2014-05-06 22:06       ` Junio C Hamano
  2 siblings, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-02 21:55 UTC (permalink / raw)
  To: Jeff King, Felipe Contreras
  Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

Jeff King wrote:
> On Fri, May 02, 2014 at 02:11:05PM -0500, Felipe Contreras wrote:
> 
> > Junio C Hamano wrote:
> > > If we step back a bit, because we are forcing him to differentiate
> > > these two pulls in his mental model anyway, perhaps it may help
> > > people (both new and old) if we had a new command to make the
> > > distinction stand out more.  What if the command sequence were like
> > > this instead?
> > > 
> > >     $ git checkout maint
> > >     $ git update [ origin maint ]
> > > 
> > >     $ git pull [--no-ff] developer-remote topic-branch
> > >     $ git push [ origin maint ]
> > > 
> > > where the new command 'update' enforces the '--ff-only' update.  And
> > > then we would stop telling "'git pull' first" when a push does not
> > > fast-forward.
> > 
> > In addition to barf when it's not a fast-forward, such command can
> > switch the parents, so it appears 'maint' was merged to 'origin/maint'.
> > Many people have complained about this order.
> 
> I realize this has veered off into talking about an "update" command,
> and not necessarily "pull", but since there a lot of proposals floating
> around, I wanted to make one point: if we are going to do such a switch,
> let's please make it something the user explicitly turns on.

This is sensible, but with warning "X will be the default in the
future", just like we did with push.default = simple.

> One common workflow for GitHub users is to back-merge master into a
> topic, because they want the final "integrated" version on the topic
> branch. That lets it get review, run tests, and even get test-deployed
> from there before merging to master (and then when it does merge to
> master, we know the result will be a trivial merge).  This workflow
> helps spread out the load (there is no central "integration" person or
> script, and the merge itself becomes a possible part of the review/test
> cycle).  Some projects will do this by rebasing the topic, but that has
> its own complications (like making collaboration harder because the
> commits are being frequently rewritten).

They can do:

% git pull origin master

That shouldn't revese the bases.

> Such users are going to run "git pull origin master" or just "git pull"
> to get that merge.

I'd say the vast majority of users running "git pull" want the parents
reversed, the minority that doesn't can switch to "git pull origin
master" (or add a configuration).

> A switch to disallowing non-ff is going to disrupt
> that workflow.

Only if the refuse to do "git pull origin master".

> But I think that is the same moment they should probably be deciding on
> whether their workflow wants "regular" or "reverse" merges. And I do not
> think the decision between the two has an obvious split over which is
> better.

Because there hasn't been enough discussion on this topic. I'm fairly
certain there will be consensus once concrete proposals are properly
discussed.

Most likely the consensus and the proposals will be ignored and nothing
will change as usual, but that's a different thing.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 15:37 Pull is Mostly Evil Marc Branchaud
  2014-05-02 15:45 ` David Kastrup
  2014-05-02 18:13 ` Junio C Hamano
@ 2014-05-02 22:12 ` Philip Oakley
  2014-05-09 19:49 ` Marc Branchaud
  3 siblings, 0 replies; 50+ messages in thread
From: Philip Oakley @ 2014-05-02 22:12 UTC (permalink / raw)
  To: Marc Branchaud, Git Mailing List

From: "Marc Branchaud" <marcnarc@xiplink.com>
Sent: Friday, May 02, 2014 4:37 PM
> (Apologies for not CCing all the folks who've participated in the 
> "Pull is
> Evil" thread -- I couldn't find a good branch of that thread for this 
> message.)
>
> OK, so maybe "git pull" is just Mostly Evil.  People seem to have 
> found many
> different ways to make it work for them.
>
> But in reality "git pull" has become a chimera that confuses a large 
> number
> of new users, and that experienced users either avoid entirely or 
> customize
> to give them a convenient shorthand for working in their particular
> environment.  As a tool for new git users, it just doesn't seem to be
> achieving its goals.
>
> I think the git project as a whole would benefit if it started to 
> treat "git
> pull" as an advanced command, in the sense that it needs to be 
> configured by
> an experienced user in order to make it correctly follow a project's
> workflow.  Once it's configured properly, "git pull" is a powerful 
> tool that
> gives users an easy way to do complex things.  In that sense, it may 
> be
> appropriate for a project to tailor "git pull" as it likes, then teach 
> its
> own users to use the command.
>
> However, when it comes to teaching people how to use git qua git, "git 
> pull"
> should be the last thing they learn about, because it's only after you
> understand various basic git concepts that you can configure "git 
> pull" to do
> the right thing.
>
> To that end, I suggest that pull's default behaviour should be to do
> *nothing*.  It should just print out a message to the effect that it 
> hasn't
> been configured, and that the user should run "git help pull" for 
> guidance.
>
I tend to agree.
The hard part is making sure folk have enough prior learning to make a 
choice that their will fit their real needs.

> It'll take quite a bit of time, but I think that if we change our 
> attitude
> towards "git pull" and take this unconfigured-by-default approach, 
> then in a
> few years the entire git ecosystem will be in a better place.
>
> M.
> --
Philip

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 19:05     ` Felipe Contreras
@ 2014-05-02 22:34       ` Philip Oakley
  2014-05-02 22:53         ` Jonathan Nieder
  2014-05-02 23:23         ` Felipe Contreras
  0 siblings, 2 replies; 50+ messages in thread
From: Philip Oakley @ 2014-05-02 22:34 UTC (permalink / raw)
  To: Felipe Contreras, git, David Kastrup

From: "Felipe Contreras" <felipe.contreras@gmail.com>
Sent: Friday, May 02, 2014 8:05 PM
> Philip Oakley wrote:
>> From: "David Kastrup" <dak@gnu.org>
>> > Marc Branchaud <marcnarc@xiplink.com> writes:
>> >
>> >> To that end, I suggest that pull's default behaviour should be to 
>> >> do
>> >> *nothing*.  It should just print out a message to the effect that 
>> >> it
>> >> hasn't been configured, and that the user should run "git help 
>> >> pull"
>> >> for guidance.
>> >
>> > Fetching is uncontentious, and I _think_ that fast-forwards are 
>> > pretty
>> > uncontentious as well.
>>
>> While the fast forward is /pretty/ uncontentious, it still maybe
>> contentious for some.
>
> So? No defaults can please absolutely everyone, the best anybody can 
> do
> is try to please the majority of people, and merging fast-forwards 
> only
> does that.

That assumes that doing something is better than doing nothing, which is 
appropriate when the costs on either side are roughly similar. However 
in this case, as we have essentially all agreed, there have been some 
bad down sides. In that case a precautionary principle is more 
appropriate where doing nothing (that is git pull does nothing until 
user configured) is better.

While a shift to merging fast-forwards would reduce the cost difference, 
they have to be matched against the potential user confusions when 
comparing to all the old web miss-instructions, hence my shift away from 
trying to best guess a default, rather than simply suggest it as a 
suitable user choice.
>
> -- 
> Felipe Contreras
> --
Philip 

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 21:55       ` Felipe Contreras
@ 2014-05-02 22:36         ` Jeff King
  2014-05-02 23:27           ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: Jeff King @ 2014-05-02 22:36 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

On Fri, May 02, 2014 at 04:55:01PM -0500, Felipe Contreras wrote:

> They can do:
> 
> % git pull origin master
> 
> That shouldn't revese the bases.

Then they have to remember to do that every time, no? That seems a
little error-prone versus setting a config option.

> > Such users are going to run "git pull origin master" or just "git pull"
> > to get that merge.
> 
> I'd say the vast majority of users running "git pull" want the parents
> reversed, the minority that doesn't can switch to "git pull origin
> master" (or add a configuration).

I'm not sure I agree, but I don't think either of us has actual data.

> Most likely the consensus and the proposals will be ignored and nothing
> will change as usual, but that's a different thing.

Is it truly necessary to make sniping comments like this at the end of
each email? It _is_ being discussed right now, and these comments do
nothing except irritate your readers. Please stop.

-Peff

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 22:34       ` Philip Oakley
@ 2014-05-02 22:53         ` Jonathan Nieder
  2014-05-03 20:24           ` Philip Oakley
  2014-05-02 23:23         ` Felipe Contreras
  1 sibling, 1 reply; 50+ messages in thread
From: Jonathan Nieder @ 2014-05-02 22:53 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Felipe Contreras, git, David Kastrup

Hi,

Philip Oakley wrote:

> That assumes that [git pull] doing something is better than doing nothing,
> which is appropriate when the costs on either side are roughly
> similar.

I think the conversation's going around in circles.

Potential next steps:

 a. Documentation or test patch illustrating desired behavior

 b. More traditional formal design doc explaining desired behavior and
    the thinking behind it ("problem", "overview of solution",
    "alternatives rejected", "complications", "example", "open
    questions").

 c. Implementation patch

 d. Someone takes an existing patch and figures out the next step
    toward getting it ready for application.

My preference is for (a), I guess.

The point being that something more concrete (code or a design doc)
makes it easier to avoid talking past each other.  And having
something concrete to edit makes the stakes clearer so people can make
it incrementally better without being distracted by unimportant parts.

Thanks and hope that helps,
Jonathan

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 22:34       ` Philip Oakley
  2014-05-02 22:53         ` Jonathan Nieder
@ 2014-05-02 23:23         ` Felipe Contreras
  2014-05-03 11:24           ` Philip Oakley
  1 sibling, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-02 23:23 UTC (permalink / raw)
  To: Philip Oakley, Felipe Contreras, git, David Kastrup

Philip Oakley wrote:
> From: "Felipe Contreras" <felipe.contreras@gmail.com>
> > So? No defaults can please absolutely everyone, the best anybody can
> > do is try to please the majority of people, and merging
> > fast-forwards only does that.
> 
> That assumes that doing something is better than doing nothing,

When doing something is better for the vast majority of people, that's
what should be done by default, unless the results are catastrophic for
the minority.

Since doing something is not catastrophic to the minority, it follows
that the default should be to do something.

It's a simple as that.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 22:36         ` Jeff King
@ 2014-05-02 23:27           ` Felipe Contreras
  0 siblings, 0 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-02 23:27 UTC (permalink / raw)
  To: Jeff King, Felipe Contreras
  Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

Jeff King wrote:
> On Fri, May 02, 2014 at 04:55:01PM -0500, Felipe Contreras wrote:
> 
> > They can do:
> > 
> > % git pull origin master
> > 
> > That shouldn't revese the bases.
> 
> Then they have to remember to do that every time, no? That seems a
> little error-prone versus setting a config option.

Yes. However, since not many people do this, and they don't do it that
often that's not a big deal.

It's much more important to fix the issue the vast majority of users
face constantly.

> > > Such users are going to run "git pull origin master" or just "git pull"
> > > to get that merge.
> > 
> > I'd say the vast majority of users running "git pull" want the parents
> > reversed, the minority that doesn't can switch to "git pull origin
> > master" (or add a configuration).
> 
> I'm not sure I agree, but I don't think either of us has actual data.

Do you want me to go dig in the mailing list and point you to the
endless discussions?

I assure you, if this is not changed, we will have this discussion
again.

> > Most likely the consensus and the proposals will be ignored and nothing
> > will change as usual, but that's a different thing.
> 
> Is it truly necessary to make sniping comments like this at the end of
> each email? It _is_ being discussed right now, and these comments do
> nothing except irritate your readers. Please stop.

And it has been discussed before. If history is any indication, it will
be discussed again.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 21:48     ` Jeff King
  2014-05-02 21:55       ` Felipe Contreras
@ 2014-05-03  2:18       ` David Kastrup
  2014-05-06 22:06       ` Junio C Hamano
  2 siblings, 0 replies; 50+ messages in thread
From: David Kastrup @ 2014-05-03  2:18 UTC (permalink / raw)
  To: git

Jeff King <peff@peff.net> writes:

> On Fri, May 02, 2014 at 02:11:05PM -0500, Felipe Contreras wrote:
>
>> Junio C Hamano wrote:
>> > If we step back a bit, because we are forcing him to differentiate
>> > these two pulls in his mental model anyway, perhaps it may help
>> > people (both new and old) if we had a new command to make the
>> > distinction stand out more.  What if the command sequence were like
>> > this instead?
>> > 
>> >     $ git checkout maint
>> >     $ git update [ origin maint ]
>> > 
>> >     $ git pull [--no-ff] developer-remote topic-branch
>> >     $ git push [ origin maint ]
>> > 
>> > where the new command 'update' enforces the '--ff-only' update.  And
>> > then we would stop telling "'git pull' first" when a push does not
>> > fast-forward.
>> 
>> In addition to barf when it's not a fast-forward, such command can
>> switch the parents, so it appears 'maint' was merged to 'origin/maint'.
>> Many people have complained about this order.
>
> I realize this has veered off into talking about an "update" command,
> and not necessarily "pull", but since there a lot of proposals floating
> around, I wanted to make one point: if we are going to do such a switch,
> let's please make it something the user explicitly turns on.

A safety catch defaulting to a factory position of "off" is not going to
stop inexperienced people from shooting themselves in the foot.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 18:13 ` Junio C Hamano
  2014-05-02 19:11   ` Felipe Contreras
@ 2014-05-03  7:56   ` Richard Hansen
  2014-05-03  8:17     ` David Kastrup
                       ` (2 more replies)
  2014-05-03 10:00   ` John Szakmeister
  2 siblings, 3 replies; 50+ messages in thread
From: Richard Hansen @ 2014-05-03  7:56 UTC (permalink / raw)
  To: Junio C Hamano, Marc Branchaud; +Cc: Git Mailing List

On 2014-05-02 14:13, Junio C Hamano wrote:
> Stepping back even further, and thinking what is different between
> these two pulls, we notice that the first one is pulling from the
> place we push back to.

I think the fundamental difference is in the relationship between the
local and the remote branch (which branch derives from the other).
The relationship between the branches determines what the user wants
from 'git pull'.

In my experience 'git pull' is mostly (only?) used for the following
three tasks:

 1. update a local branch to incorporate the latest upstream changes

    In this case, the local branch (master) is a derivative of the
    upstream branch (origin/master).  The user wants all of the
    commits in the remote branch to be in the local branch.  And the
    user would like the local changes, if any, to descend from the tip
    of the remote branch.

    For this case, 'git pull --ff-only' followed by 'git rebase -p'
    works well, as does 'git pull --rebase=preserve' if the user is
    comfortable rebasing without reviewing the incoming commits first.
    A plain 'git pull' or 'git pull --ff' is suboptimal due to the
    awkward backwards-parents merge commit.

 2. update a published feature branch with the latest changes from its
    parent branch

    In this case, the local branch (foo) is a derivative of the
    upstream branch (origin/foo) which is itself a derivative of
    another branch (origin/master).  All commits in origin/master
    should be in origin/foo, and ideally all commits unique to
    origin/foo would descend from the tip of origin/master.

    The relationship between origin/foo and origin/master is similar
    to the relationship between master and origin/master in case #1
    above, but rebase is frowned upon because the feature branch has
    been shared with other developers (and the shared repository might
    reject non-ff updates).

    This case is sort-of like case #1 above (updating) and sort-of
    like case #3 below (integrating).

    For this case, after the local branch foo is updated (case #1
    above), 'git pull --ff origin master' or 'git fetch --all && git
    merge --ff origin/master' work well to update origin/foo.

 3. integrate a more-or-less complete feature/fix back into the line
    of development it forked off of

    In this case the local branch is a primary line of development and
    the remote branch contains the derivative work.  Think Linus
    pulling in contributions.  Different situations will call for
    different ways to handle this case, but most will probably want
    some or all of:

     * rebase the remote commits onto local HEAD
     * merge into local HEAD so that the first parent (if a real merge
       and not a ff) is the previous version of the main line of
       development and the second parent is the derivative work
     * merge --no-ff so that:
        - the merge can serve as a cover letter (who reviewed it,
          which bug reports were fixed, where the changes came from,
          etc.)
        - the commits that compose the new topic are grouped together
        - the first-parent path represents a series of completed tasks

    (I prefer to do all three, although I may skip the rebase if the
    commits came from another public repository so as to not annoy
    users of that downstream repository.)

    For this case, 'git pull --no-ff' is better than 'git pull --ff'
    (for the reasons listed above), but perhaps something more
    elaborate would be ideal (e.g., rebase there onto here, then merge
    --no-ff).

These three usage patterns are at odds; it's hard to change the
default behavior of 'git pull' to favor one usage case without harming
another.  Perhaps this is why there's so much disagreement about what
'git pull' should do.

I see a few ways to improve the situation:

  1. Add one or two new commands to split up how the three cases are
     handled.  For example:

      * Add a new 'git update' command that is friendly for case
        #1.  Update tutorials to recommend 'git update' instead of
        'git pull'.  It would behave like 'git pull --ff-only' by
        default.

        It could behave like 'git pull --rebase[=preserve]' instead,
        but this has a few downsides:
         - It doesn't give the user an opportunity to review the
           incoming commits before rebasing (e.g., to see what sort of
           conflicts to expect).
         - It subjects new users to that scary rebase thing before
           they are prepared to handle it.
         - The branch to be updated must be checked out.  If 'git
           update' used --ff-only, then 'git update --all' could
           fast-forward all local branches to their configured
           upstreams when possible.  (How cool would that be?)

      * Leave 'git pull' and 'git pull $remote [$refspec]' alone --
        the current defaults are acceptable (though maybe not ideal)
        for cases #2 and #3.

     Another example:

      * Add a new 'git integrate' command to handle case #3.  Ideally
        it would be configurable enough to work with various
        workflows.  It would behave like 'git pull --no-ff' by
        default.

      * Change plain 'git pull' to assume case #1 and default to
        --ff-only.  It could default to --rebase[=preserve] instead,
        but that has the same downsides as those listed for 'git
        update' above.

      * Have 'git pull $remote [$refspec]' also default to merge
        --ff-only.  It could assume case #2 and default to --ff, but
        that would cause 'git pull' to have different behaviors
        depending on how it is invoked.  That might be too confusing
        to users.  If 'git pull origin master' errors out due to
        non-ff, it's easy enough for users to manually run 'git merge
        origin/master'.  Alternatively users could use 'git integrate
        origin master', so long as it does not rebase by default.
        Thus, I don't think that defaulting to --ff-only (when the
        remote is specified) would be a huge loss.

  2. Teach 'git pull' to have different defaults depending on how it
     is invoked:

      * If plain 'git pull', assume case #1 above and default to merge
        --ff-only.
      * If 'git pull $configured_remote_name [$refspec]', assume case
        #2 and default to merge --ff.
      * If 'git pull $url [$refspec]', assume case #3 and default to
        merge --no-ff.

     I'm not a fan of this approach -- it seems like it would be a
     huge source of confusion for users.

  3. Add some branch metadata to automatically figure out branch
     relationships, then adjust the default behavior of 'git pull'
     according to that metadata.  This seems like a complicated and
     disruptive change, but it could have other benefits.

Of these options, I prefer adding a new 'git integrate' command and
changing 'git pull' (and 'git pull $remote [$refspec]') to default to
--ff-only.

-Richard

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03  7:56   ` Richard Hansen
@ 2014-05-03  8:17     ` David Kastrup
  2014-05-03  9:04       ` Felipe Contreras
  2014-05-03  9:26     ` Felipe Contreras
  2014-05-07 22:37     ` Max Kirillov
  2 siblings, 1 reply; 50+ messages in thread
From: David Kastrup @ 2014-05-03  8:17 UTC (permalink / raw)
  To: Richard Hansen; +Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

Richard Hansen <rhansen@bbn.com> writes:

> These three usage patterns are at odds; it's hard to change the
> default behavior of 'git pull' to favor one usage case without harming
> another.  Perhaps this is why there's so much disagreement about what
> 'git pull' should do.

Should a screwdriver be turning clockwise or counterclockwise by
default?  There are valid arguments for either.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03  8:17     ` David Kastrup
@ 2014-05-03  9:04       ` Felipe Contreras
  2014-05-03  9:56         ` David Kastrup
  0 siblings, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-03  9:04 UTC (permalink / raw)
  To: David Kastrup, Richard Hansen
  Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

David Kastrup wrote:
> Richard Hansen <rhansen@bbn.com> writes:
> 
> > These three usage patterns are at odds; it's hard to change the
> > default behavior of 'git pull' to favor one usage case without
> > harming another.  Perhaps this is why there's so much disagreement
> > about what 'git pull' should do.
> 
> Should a screwdriver be turning clockwise or counterclockwise by
> default?  There are valid arguments for either.

If you don't have anything to contribute don't disturb the people that
actually care and are trying to improve Git. Thanks.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03  7:56   ` Richard Hansen
  2014-05-03  8:17     ` David Kastrup
@ 2014-05-03  9:26     ` Felipe Contreras
  2014-05-03 22:09       ` Richard Hansen
  2014-05-07 22:37     ` Max Kirillov
  2 siblings, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-03  9:26 UTC (permalink / raw)
  To: Richard Hansen, Junio C Hamano, Marc Branchaud; +Cc: Git Mailing List

Richard Hansen wrote:

> I think the fundamental difference is in the relationship between the
> local and the remote branch (which branch derives from the other).
> The relationship between the branches determines what the user wants
> from 'git pull'.
> 
> In my experience 'git pull' is mostly (only?) used for the following
> three tasks:

I agree.

>  1. update a local branch to incorporate the latest upstream changes
> 
>     In this case, the local branch (master) is a derivative of the
>     upstream branch (origin/master).  The user wants all of the
>     commits in the remote branch to be in the local branch.  And the
>     user would like the local changes, if any, to descend from the tip
>     of the remote branch.

My current propsal of making `git pull` by default do --ff-only would
solve this. In addition I think by default 'master' should be merged to
'origin/master', if say --merge is given.

>     For this case, 'git pull --ff-only' followed by 'git rebase -p'
>     works well, as does 'git pull --rebase=preserve' if the user is
>     comfortable rebasing without reviewing the incoming commits first.

I suppose you mean a `git rebase -p` if the `git pull --ff-only` failed.
This might be OK on most projects, but not all.

What happens after a `git pull --ff-only` fails should be totally
up to the user.

>  2. update a published feature branch with the latest changes from its
>     parent branch
> 
>     In this case, the local branch (foo) is a derivative of the
>     upstream branch (origin/foo) which is itself a derivative of
>     another branch (origin/master).  All commits in origin/master
>     should be in origin/foo, and ideally all commits unique to
>     origin/foo would descend from the tip of origin/master.

I don't understand why are you tainting the example with 'origin/foo',
'foo' and 'origin/master' are enough for this example. In fact, the
mention of 'origin/master' made it wrong: after the pull not all the
commits of origin/master would be in origin/foo, you need a push for
that. We have enough in our plate to taint this with yet another branch
and push.

For this case `git pull origin master` already work correctly for most
projects. We probably shouldn't change that.

>  3. integrate a more-or-less complete feature/fix back into the line
>     of development it forked off of
> 
>     In this case the local branch is a primary line of development and
>     the remote branch contains the derivative work.  Think Linus
>     pulling in contributions.  Different situations will call for
>     different ways to handle this case, but most will probably want
>     some or all of:
> 
>      * rebase the remote commits onto local HEAD

No. Most people will merge the remote branch as it is. There's no reason
to rebase, specially if you are creating a merge commit.

>      * merge into local HEAD so that the first parent (if a real merge
>        and not a ff) is the previous version of the main line of
>        development and the second parent is the derivative work
>      * merge --no-ff so that:
>         - the merge can serve as a cover letter (who reviewed it,
>           which bug reports were fixed, where the changes came from,
>           etc.)
>         - the commits that compose the new topic are grouped together
>         - the first-parent path represents a series of completed tasks

It is very rare that an integrator is even able to do a fast-forward
merge anyway. So being explicit about --no-ff might better, but it would
hardly make a difference. Either way, a good integrator would configure
pull.ff = false.

I'd say `git pull origin master` already works fine for this case.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03  9:04       ` Felipe Contreras
@ 2014-05-03  9:56         ` David Kastrup
  2014-05-04  4:30           ` David Lang
  0 siblings, 1 reply; 50+ messages in thread
From: David Kastrup @ 2014-05-03  9:56 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Richard Hansen, Junio C Hamano, Marc Branchaud, Git Mailing List

Felipe Contreras <felipe.contreras@gmail.com> writes:

> David Kastrup wrote:
>> Richard Hansen <rhansen@bbn.com> writes:
>> 
>> > These three usage patterns are at odds; it's hard to change the
>> > default behavior of 'git pull' to favor one usage case without
>> > harming another.  Perhaps this is why there's so much disagreement
>> > about what 'git pull' should do.
>> 
>> Should a screwdriver be turning clockwise or counterclockwise by
>> default?  There are valid arguments for either.
>
> If you don't have anything to contribute don't disturb the people that
> actually care and are trying to improve Git. Thanks.

No need to expand on the welcoming atmosphere here.  My heinous plot to
subvert the quality of Git has already been thwarted by making sure that
its "meritocracy" continues relying only on input from those with an
independent income.  I'm just sticking around until my current
contributions move into master so that I can summarize the resulting
low-hanging fruit that the meritorious can then pick at great fanfare.

The sooner my work moves from pu into master, the sooner y'all be rid of
me.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 18:13 ` Junio C Hamano
  2014-05-02 19:11   ` Felipe Contreras
  2014-05-03  7:56   ` Richard Hansen
@ 2014-05-03 10:00   ` John Szakmeister
  2014-05-05 15:39     ` Richard Hansen
  2 siblings, 1 reply; 50+ messages in thread
From: John Szakmeister @ 2014-05-03 10:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Marc Branchaud, Git Mailing List

On Fri, May 2, 2014 at 2:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
[snip]
> Your earlier long-hand, together with the two examples that pulls
> into the same "maint" branch Brian gave us, may give us a better
> starting points to think about a saner way.
>
> To me, the problem sounds like:
>
>     Tutorials of Git often says "use 'git pull' to catch up your
>     branch with your upstream work and then 'git push' back" (and
>     worse yet, 'git push' that does not fast-forward suggests doing
>     so), but 'git pull' that creates a merge in a wrong direction is
>     not the right thing for many people.

Yes, that's a good portion of the problem.

> And proposed solutions range from "let's write 'pull' off as a
> failed experiment" to "let's forbid any merge made by use of 'pull'
> by default, because it is likely that merge may be in reverse".

FWIW, at my company, we took another approach.  We introduced a `git
ffwd` command that fetches from all remotes, and fast-forwards all
your local branches that are tracking a remote, and everyone on the
team uses it all the time.  It should be said this team also likes to
use Git bare-metal, because they like knowing how things work
out-of-the-box.  But they all use the command because it's so
convenient.

I had started making a C version a while back, but never completed it.
 I could take a stab at doing so again, if there's interest.

-John

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 23:23         ` Felipe Contreras
@ 2014-05-03 11:24           ` Philip Oakley
  2014-05-03 11:30             ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: Philip Oakley @ 2014-05-03 11:24 UTC (permalink / raw)
  To: Felipe Contreras, git, David Kastrup

From: "Felipe Contreras" <felipe.contreras@gmail.com>
Sent: Saturday, May 03, 2014 12:23 AM
> Philip Oakley wrote:
>> From: "Felipe Contreras" <felipe.contreras@gmail.com>
>> > So? No defaults can please absolutely everyone, the best anybody 
>> > can
>> > do is try to please the majority of people, and merging
>> > fast-forwards only does that.
>>
>> That assumes that doing something is better than doing nothing,
>
> When doing something is better for the vast majority of people, that's
> what should be done by default, unless the results are catastrophic 
> for
> the minority.
>
> Since doing something is not catastrophic to the minority, it follows
> that the default should be to do something.
>
That 'Since' and 'it follows' are where we have a diverging 
understanding about the solution approach...

> It's a simple as that.

... which makes it not quite as simple as that ;-) [evidence: the 
ongoing dialog among all and sundry]
>
> -- 
> Felipe Contreras
> --

Philip 

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03 11:24           ` Philip Oakley
@ 2014-05-03 11:30             ` Felipe Contreras
  0 siblings, 0 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-03 11:30 UTC (permalink / raw)
  To: Philip Oakley, Felipe Contreras, git, David Kastrup

Philip Oakley wrote:
> From: "Felipe Contreras" <felipe.contreras@gmail.com>
> > When doing something is better for the vast majority of people, that's
> > what should be done by default, unless the results are catastrophic 
> > for
> > the minority.
> >
> > Since doing something is not catastrophic to the minority, it follows
> > that the default should be to do something.

> > It's a simple as that.
> 
> ... which makes it not quite as simple as that ;-) [evidence: the 
> ongoing dialog among all and sundry]

The dialog is not simple becuase it's not easy to make `git pull` do the
sensible thing. That doesn't mean `git pull` should do *nothing*, that
doesn't follow from the argument above.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 22:53         ` Jonathan Nieder
@ 2014-05-03 20:24           ` Philip Oakley
  0 siblings, 0 replies; 50+ messages in thread
From: Philip Oakley @ 2014-05-03 20:24 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Felipe Contreras, Git List, David Kastrup

From: "Jonathan Nieder" <jrnieder@gmail.com>
Sent: Friday, May 02, 2014 11:53 PM
> Hi,
>
> Philip Oakley wrote:
>
>> That assumes that [git pull] doing something is better than doing
>> nothing,
>> which is appropriate when the costs on either side are roughly
>> similar.
>
> I think the conversation's going around in circles.

I agree it's going around, but it's a non-exact recurrence. Issues are
being surfaced.
>
> Potential next steps:
>
> a. Documentation or test patch illustrating desired behavior
>
> b. More traditional formal design doc explaining desired behavior and
>    the thinking behind it ("problem", "overview of solution",
>    "alternatives rejected", "complications", "example", "open
>    questions").
>
> c. Implementation patch
>
> d. Someone takes an existing patch and figures out the next step
>    toward getting it ready for application.
>
> My preference is for (a), I guess.

I disagree about the leap to the presentation & discussion of a
'solution' in these awkward scenarios (the old joke about "if I were you
I wouldn't start from here", when asking for directions tends to apply).
This is the same point made by Brooks in the 'Mythical Man Month'. A
leap to code is no guarantee of success.

>
> The point being that something more concrete (code or a design doc)
> makes it easier to avoid talking past each other.  And having
> something concrete to edit makes the stakes clearer so people can make
> it incrementally better without being distracted by unimportant parts.

We've had Junio's training wheel, and now Filipe's n'th attempt at code
examples, so my bad code wouldn't help ;-). As a systems engineer I've
seen these confusions quite a few times in different guises.

I tend to fall back to P Checkland's "Systems Thinking, Systems
Practice" model of the various processes that have to go on [1] to
improve the situation (note he doesn't expect a solved solution in most
cases, just an improvement in the situation). At the moment most of the
discussion is in the "unstructured" parts of the processes. He also
identifies 6 elements 'CATWOE' [2] that need to be considered when
studying these problems.

Most of the discussion/arguments here are about the different
'Weltanshaung's" (world views) of the contributors.

In terms of the new user pull problem, what needs to be modeled is the
new user's and their weltanshaung, not how we ('experienced' users?)
might 'solve' the problem.

The pull problem is, I believe part of the bigger problem of the
mind-set shift required for the transition to a DVCS for most new users.
Git has grown organically, so still has some soft (unclear) edges, which
probably needs more than just a transition plan for Filipe's pull
changes, and its choice of the final default (or lack of).

For example, if users aren't understanding the differences between
remote branches, remote tracking branches, and branches, which is part
of the pull problem; have we made it easy for them to understand? [They
already have to comprehend the 'staging' concept, so are already
cognitively fully loaded].

For the branch type example, some cleaner naming may help, such as:
'remote branch', 'Tracking branch', and '(local) branch', which excludes
the noiseword 'remote' from 'Tracking branches' (my deliberate 'T'
emphasis). Though that does still leave the confusion between remote
servers and remote repos, where the latter may actually be local, and if
a file path, be the local '.' repo itself!

>
> Thanks and hope that helps,

Sorry if this went off at a tangent, but I believe it's important to get
to the bottom of the new user problems, which are deeper than just a few 
command defaults.

> Jonathan
> --

Philip
--
[1]
http://40qx6d15vq6j25i83v3ks8nxfux.wpengine.netdna-cdn.com/files/2012/08/seven-steps2.gif
or http://portals.wi.wur.nl/spicad/?Soft_Systems_Methodology Checkland's
7 Steps.

[2] CATWOE: customers, actors, transformation, weltanshaung, owners,
environment.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03  9:26     ` Felipe Contreras
@ 2014-05-03 22:09       ` Richard Hansen
  2014-05-04  3:08         ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: Richard Hansen @ 2014-05-03 22:09 UTC (permalink / raw)
  To: Felipe Contreras, Junio C Hamano, Marc Branchaud; +Cc: Git Mailing List

On 2014-05-03 05:26, Felipe Contreras wrote:
> Richard Hansen wrote:
> 
>> I think the fundamental difference is in the relationship between the
>> local and the remote branch (which branch derives from the other).
>> The relationship between the branches determines what the user wants
>> from 'git pull'.
>>
>> In my experience 'git pull' is mostly (only?) used for the following
>> three tasks:
> 
> I agree.
> 
>>  1. update a local branch to incorporate the latest upstream changes
>>
>>     In this case, the local branch (master) is a derivative of the
>>     upstream branch (origin/master).  The user wants all of the
>>     commits in the remote branch to be in the local branch.  And the
>>     user would like the local changes, if any, to descend from the tip
>>     of the remote branch.
> 
> My current propsal of making `git pull` by default do --ff-only would
> solve this.

It would go a long way toward improving the situation, yes.

> In addition I think by default 'master' should be merged to
> 'origin/master', if say --merge is given.

This would break cases #2 and #3.  (With cases #2 and #3 you want the
fetched branch to be the second parent, not the first.)

Or are you proposing that pull --merge should reverse the parents if and
only if the remote ref is @{u}?

> 
>>     For this case, 'git pull --ff-only' followed by 'git rebase -p'
>>     works well, as does 'git pull --rebase=preserve' if the user is
>>     comfortable rebasing without reviewing the incoming commits first.
> 
> I suppose you mean a `git rebase -p` if the `git pull --ff-only` failed.

Yes.

> This might be OK on most projects, but not all.

The rebase only affects the local repository (the commits haven't been
pushed yet or else they'd be in @{u} already), so I'd say it's more of
an individual developer decision than a project decision.

In my opinion rebase would be the best option here, but if the project
is OK with developers pushing merge or merge-there commits and the
developer isn't yet comfortable with rebasing, then merge is also an
acceptable option.

> 
> What happens after a `git pull --ff-only` fails should be totally
> up to the user.

I tend to agree, mostly because I want users to have an opportunity to
review incoming commits before action is taken.  Also, though rebasing
would yield the nicest history, some users aren't yet comfortable with
rebase.  If a project is OK with silly little merge commits from users
that aren't comfortable with rebase, then I don't want to force everyone
to rebase by default.

As an added bonus:  Defaulting to --ff-only makes it possible for 'git
pull --all' to fast-forward every local branch to their configured
upstream, not just the currently checked-out branch.  I think this would
be a huge usability win.

> 
>>  2. update a published feature branch with the latest changes from its
>>     parent branch
>>
>>     In this case, the local branch (foo) is a derivative of the
>>     upstream branch (origin/foo) which is itself a derivative of
>>     another branch (origin/master).  All commits in origin/master
>>     should be in origin/foo, and ideally all commits unique to
>>     origin/foo would descend from the tip of origin/master.
> 
> I don't understand why are you tainting the example with 'origin/foo',

Originally I didn't have this case in my list, but I added it after
thinking about Peff's comment:

  On 2014-05-02 17:48, Jeff King wrote:
  > One common workflow for GitHub users is to back-merge master into a
  > topic, because they want the final "integrated" version on the topic
  > branch.

This almost but doesn't quite fit neatly into the other two cases.  It's
not case #1 because the shared nature of origin/foo means that rebasing
origin/foo onto origin/master is usually bad instead of usually good.
It's not case #3 because rebasing origin/master commits onto origin/foo
(assuming that the user would usually want to rebase the topic branch
when integrating) would definitely be bad.

> 'foo' and 'origin/master' are enough for this example. In fact, the
> mention of 'origin/master' made it wrong: after the pull not all the
> commits of origin/master would be in origin/foo, you need a push for
> that.

The push of foo to origin/foo was meant to be implied.

> We have enough in our plate to taint this with yet another branch
> and push.
> 
> For this case `git pull origin master` already work correctly for most
> projects.

Yes, it does.

> We probably shouldn't change that.

If we change 'git pull' to default to --ff-only but let 'git pull
$remote [$refspec]' continue to default to --ff then we have two
different behaviors depending on how 'git pull' is invoked.  I'm worried
that this would trip up users.  I'm not convinced that having two
different behaviors would be bad, but I'm not convinced that it would be
good either.

> 
>>  3. integrate a more-or-less complete feature/fix back into the line
>>     of development it forked off of
>>
>>     In this case the local branch is a primary line of development and
>>     the remote branch contains the derivative work.  Think Linus
>>     pulling in contributions.  Different situations will call for
>>     different ways to handle this case, but most will probably want
>>     some or all of:
>>
>>      * rebase the remote commits onto local HEAD
> 
> No. Most people will merge the remote branch as it is. There's no reason
> to rebase, specially if you are creating a merge commit.

I disagree.  I prefer to rebase a topic branch before merging (no-ff) to
the main line of development for a couple of reasons:

  * It makes commits easier to review.  For example, assume the
    following commit history:

       * merge topic-foo
       |\
       | * merge master into topic-foo
       |/|
       * | tweak the behavior of Thing
       | |
       | * refactor Thing
       | |
       | * wrap long lines; no behavior changes
       |/
       * blah
       |
       ...

    In this case, the impact the "refactor Thing" and "wrap long lines"
    commits have on master can't be fully understood without also
    examining the presumed merge conflict resolution in the "merge
    master into topic-foo" commit.  Merge commits are very hard to
    review, even if (especially if?) there are no conflicts.
    Developers can diff 'merge topic-foo' to its first parent, but then
    they'll see lots of noise caused by the "wrap long lines" commit.

    If the integrator rebases first, then the history looks like this:

       * merge topic-foo
       |\
       | * refactor Thing
       | |
       | * wrap long lines; no behavior changes
       |/
       * tweak the behavior of Thing
       |
       * blah
       |
       ...

    Now the merge conflict resolution is integrated into the "refactor
    Thing" and "wrap long lines" commits, making them easier to review.

  * Rebasing makes the commit history pretty and easier to understand.
    Instead of this:

       * merge feature.xyz
       |\
       | * xyz part 3/3
       | |
       | * merge master into feature.xyz
       |/|
       * | merge feature.foo
       |\ \
       | | * xyz part 2/3
       | * | foo part 2/2
       | * | foo part 1/2
       | | * xyz part 1/3
       |/ /
       | /
       |/
       * merge feature.bar
       |\

    you get this:

       * merge feature.xyz
       |\
       | * xyz part 3/3
       | * xyz part 2/3
       | * xyz part 1/3
       |/
       * merge feature.foo
       |\
       | * foo part 2/2
       | * foo part 1/2
       |/
       * merge feature.bar
       |\

    When there are regularly dozens of active branches at a time, this
    improved readability can be quite valuable.

> 
>>      * merge into local HEAD so that the first parent (if a real merge
>>        and not a ff) is the previous version of the main line of
>>        development and the second parent is the derivative work
>>      * merge --no-ff so that:
>>         - the merge can serve as a cover letter (who reviewed it,
>>           which bug reports were fixed, where the changes came from,
>>           etc.)
>>         - the commits that compose the new topic are grouped together
>>         - the first-parent path represents a series of completed tasks
> 
> It is very rare that an integrator is even able to do a fast-forward
> merge anyway.

It depends on the level of project activity.  A project as active as the
Linux kernel or Git will almost never have fast-forwards.  But
occasional contributions by random users to a small, simple project will
likely be fast-forwards.

> So being explicit about --no-ff might better, but it would
> hardly make a difference. Either way, a good integrator would configure
> pull.ff = false.

Configuring pull.ff = false is OK if the integrator only integrates and
only uses one machine.  But if the integrator also wants to develop in
the same repository, or if the integrator uses multiple machines to do
the integration work (e.g., office desktop and laptop), then setting
pull.ff may be less convenient, not more.

Maybe it's OK to require integrators to get in the habit of typing 'git
pull --no-ff'.  Presumably integrators are experienced Git users, so
they can create their own 'git integrate' alias if they don't want to
have to remember to type '--no-ff' all the time.

> 
> I'd say `git pull origin master` already works fine for this case.

It does, but again preserving the current behavior would cause the
behavior of 'git pull origin master' to be inconsistent with the
proposed ff-only default for a plain 'git pull'.

-Richard

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03 22:09       ` Richard Hansen
@ 2014-05-04  3:08         ` Felipe Contreras
  2014-05-04  7:49           ` Richard Hansen
  0 siblings, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-04  3:08 UTC (permalink / raw)
  To: Richard Hansen, Felipe Contreras, Junio C Hamano, Marc Branchaud
  Cc: Git Mailing List

Richard Hansen wrote:
> On 2014-05-03 05:26, Felipe Contreras wrote:
> > Richard Hansen wrote:
> > 
> >> I think the fundamental difference is in the relationship between the
> >> local and the remote branch (which branch derives from the other).
> >> The relationship between the branches determines what the user wants
> >> from 'git pull'.
> >>
> >> In my experience 'git pull' is mostly (only?) used for the following
> >> three tasks:
> > 
> > I agree.
> > 
> >>  1. update a local branch to incorporate the latest upstream changes
> >>
> >>     In this case, the local branch (master) is a derivative of the
> >>     upstream branch (origin/master).  The user wants all of the
> >>     commits in the remote branch to be in the local branch.  And the
> >>     user would like the local changes, if any, to descend from the tip
> >>     of the remote branch.
> > 
> > My current propsal of making `git pull` by default do --ff-only would
> > solve this.
> 
> It would go a long way toward improving the situation, yes.
> 
> > In addition I think by default 'master' should be merged to
> > 'origin/master', if say --merge is given.
> 
> This would break cases #2 and #3.  (With cases #2 and #3 you want the
> fetched branch to be the second parent, not the first.)
> 
> Or are you proposing that pull --merge should reverse the parents if and
> only if the remote ref is @{u}?

Only if no remote or branch are specified `git pull --merge`.

> > 
> >>     For this case, 'git pull --ff-only' followed by 'git rebase -p'
> >>     works well, as does 'git pull --rebase=preserve' if the user is
> >>     comfortable rebasing without reviewing the incoming commits first.
> > 
> > I suppose you mean a `git rebase -p` if the `git pull --ff-only` failed.
> 
> Yes.
> 
> > This might be OK on most projects, but not all.
> 
> The rebase only affects the local repository (the commits haven't been
> pushed yet or else they'd be in @{u} already), so I'd say it's more of
> an individual developer decision than a project decision.
> 
> In my opinion rebase would be the best option here, but if the project
> is OK with developers pushing merge or merge-there commits and the
> developer isn't yet comfortable with rebasing, then merge is also an
> acceptable option.

Precisely for that reason.

> >>  2. update a published feature branch with the latest changes from its
> >>     parent branch

> > We probably shouldn't change that.
> 
> If we change 'git pull' to default to --ff-only but let 'git pull
> $remote [$refspec]' continue to default to --ff then we have two
> different behaviors depending on how 'git pull' is invoked.  I'm worried
> that this would trip up users.  I'm not convinced that having two
> different behaviors would be bad, but I'm not convinced that it would be
> good either.

It is the only solution that has been proposed.

Moreover, while it's a bit worrisome, it wouldn't create any actual
problems. Since `git pull $what` remains the same, there's no problems
there. The only change would be on `git pull`.

Since most users are not going to do `git pull $what` therefore it would
only be a small subset of users that would notice the discrepancy
between running with $what, or not. And the only discrepancy they could
notice is that when they run `git pull $what` they expect it to be
--ff-only, or when the run `git pull` they don't. Only the former could
be an issue, but even then, it's highly unlikely that `git pull $what`
would ever be a fast-forward.

So althought conceptually it doesn't look clean, in reality there
wouldn't be any problems.

> >>  3. integrate a more-or-less complete feature/fix back into the line
> >>     of development it forked off of
> >>
> >>     In this case the local branch is a primary line of development and
> >>     the remote branch contains the derivative work.  Think Linus
> >>     pulling in contributions.  Different situations will call for
> >>     different ways to handle this case, but most will probably want
> >>     some or all of:
> >>
> >>      * rebase the remote commits onto local HEAD
> > 
> > No. Most people will merge the remote branch as it is. There's no reason
> > to rebase, specially if you are creating a merge commit.
> 
> I disagree.  I prefer to rebase a topic branch before merging (no-ff) to
> the main line of development for a couple of reasons:

Well that is *your* preference. Most people would prefer to preserve the
history.

>   * It makes commits easier to review.

The review in the vast majority of cases happens *before* the
integration.

And the problem comes when the integrator makes a mistake, which they
inevitable do (we all do), then there's no history about how the
conflict was resolved, and what whas the original patch.

That's why most people don't do this.

>   * Rebasing makes the commit history pretty and easier to understand.

It is more important to be able to track integration errors than to have
a pretty history. That is for most people.

I like to have a pretty history for my own local branches, but once
something gets integrated it's important to see who did exactly what
(the integrator did the merge).
> > It is very rare that an integrator is even able to do a fast-forward
> > merge anyway.
> 
> It depends on the level of project activity.  A project as active as the
> Linux kernel or Git will almost never have fast-forwards.  But
> occasional contributions by random users to a small, simple project will
> likely be fast-forwards.

And small simple projects don't care about such issues.

> > So being explicit about --no-ff might better, but it would
> > hardly make a difference. Either way, a good integrator would configure
> > pull.ff = false.
> 
> Configuring pull.ff = false is OK if the integrator only integrates and
> only uses one machine.  But if the integrator also wants to develop in
> the same repository, or if the integrator uses multiple machines to do
> the integration work (e.g., office desktop and laptop), then setting
> pull.ff may be less convenient, not more.

Any good integrator would find solutions for those problems easily.

Either way I don't see any proposed solutions.

> > I'd say `git pull origin master` already works fine for this case.
> 
> It does, but again preserving the current behavior would cause the
> behavior of 'git pull origin master' to be inconsistent with the
> proposed ff-only default for a plain 'git pull'.

Yes, it doesn't look clean. But I don't see any proposed alternatives.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03  9:56         ` David Kastrup
@ 2014-05-04  4:30           ` David Lang
  2014-05-04  4:38             ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: David Lang @ 2014-05-04  4:30 UTC (permalink / raw)
  To: David Kastrup
  Cc: Felipe Contreras, Richard Hansen, Junio C Hamano, Marc Branchaud,
	Git Mailing List

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1388 bytes --]

On Sat, 3 May 2014, David Kastrup wrote:

> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> David Kastrup wrote:
>>> Richard Hansen <rhansen@bbn.com> writes:
>>>
>>>> These three usage patterns are at odds; it's hard to change the
>>>> default behavior of 'git pull' to favor one usage case without
>>>> harming another.  Perhaps this is why there's so much disagreement
>>>> about what 'git pull' should do.
>>>
>>> Should a screwdriver be turning clockwise or counterclockwise by
>>> default?  There are valid arguments for either.
>>
>> If you don't have anything to contribute don't disturb the people that
>> actually care and are trying to improve Git. Thanks.
>
> No need to expand on the welcoming atmosphere here.

note that this is one person taking the "I don't see any commits from you so 
your opinion doesn't count" attitude.

the vast majority of people here do not take that attitude.

David Lang

>  My heinous plot to
> subvert the quality of Git has already been thwarted by making sure that
> its "meritocracy" continues relying only on input from those with an
> independent income.  I'm just sticking around until my current
> contributions move into master so that I can summarize the resulting
> low-hanging fruit that the meritorious can then pick at great fanfare.
>
> The sooner my work moves from pu into master, the sooner y'all be rid of
> me.
>
>

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  4:30           ` David Lang
@ 2014-05-04  4:38             ` Felipe Contreras
  2014-05-04  6:13               ` David Kastrup
  2014-05-04  6:50               ` James Denholm
  0 siblings, 2 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-04  4:38 UTC (permalink / raw)
  To: David Lang, David Kastrup
  Cc: Felipe Contreras, Richard Hansen, Junio C Hamano, Marc Branchaud,
	Git Mailing List

David Lang wrote:
> note that this is one person taking the "I don't see any commits from
> you so your opinion doesn't count" attitude.

Wrong. I said it doesn't count "for the project". Do you honestly
believe Junio cares about what some random guy on the list thinks about
default aliases? No.

If he doesn't care what literally everyone thinks about the name
"index", why would he care about that random guy?

> the vast majority of people here do not take that attitude.

It's actually the exact opposite. I don't care what is the track record
of the people in the discussion. If their argument is good, their
argument is good.

It's the others that focus on the carisma and credentials of the people
in the discussion, rather than the arguments.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  4:38             ` Felipe Contreras
@ 2014-05-04  6:13               ` David Kastrup
  2014-05-04  6:50               ` James Denholm
  1 sibling, 0 replies; 50+ messages in thread
From: David Kastrup @ 2014-05-04  6:13 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: David Lang, Richard Hansen, Junio C Hamano, Marc Branchaud,
	Git Mailing List

Felipe Contreras <felipe.contreras@gmail.com> writes:

> David Lang wrote:
>> note that this is one person taking the "I don't see any commits from
>> you so your opinion doesn't count" attitude.
>
> Wrong. I said it doesn't count "for the project".

There are a number of commits from me that actually count.  A few old
core performance ones might have actually have affected my carbon
footprint noticeably.  The one currently in pu will probably not be
called often enough for that but will at least have practical
consequences.

> Do you honestly believe Junio cares about what some random guy on the
> list thinks about default aliases? No.

Putting aside my code contributions: Git is a comparatively small
project, so if the main project you are working on with Git is Git, your
experience is limited.  So yes, input from people who are _not_ heavy
Git developers is important, since the heavy Git developers do not get
to see the heavy Git use cases a lot.

> It's actually the exact opposite. I don't care what is the track
> record of the people in the discussion. If their argument is good,
> their argument is good.

More like if they are around, they are worth getting plastered with your
frustration.

> It's the others that focus on the carisma and credentials of the
> people in the discussion, rather than the arguments.

I think you are confusing inertia with resistance.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  4:38             ` Felipe Contreras
  2014-05-04  6:13               ` David Kastrup
@ 2014-05-04  6:50               ` James Denholm
  2014-05-04  7:48                 ` David Kastrup
  2014-05-04  9:51                 ` Felipe Contreras
  1 sibling, 2 replies; 50+ messages in thread
From: James Denholm @ 2014-05-04  6:50 UTC (permalink / raw)
  To: Felipe Contreras, David Lang, David Kastrup
  Cc: Richard Hansen, Junio C Hamano, Marc Branchaud, Git Mailing List

Felipe Contreras wrote:
>David Lang wrote:
>> the vast majority of people here do not take that attitude.
>
>It's actually the exact opposite. I don't care what is the track record
>of the people in the discussion.

Ah, yes, like that discussion we once had where you totally
didn't run `git log | grep James Denholm` at one point to demonstrate that I had not yet made any
contributions,instead of actually engaging in discussion. Oh,
wait.

>If their argument is good, their argument is good.

The problem, though, is that time and time again you've
shown that you value your own arguments to the exclusion
of all others. You can't tell if someone else's argument is
 good, because it runs against yours, and yours must be
right because you hold it.

Regards,
James Denholm.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  6:50               ` James Denholm
@ 2014-05-04  7:48                 ` David Kastrup
  2014-05-04  9:51                 ` Felipe Contreras
  1 sibling, 0 replies; 50+ messages in thread
From: David Kastrup @ 2014-05-04  7:48 UTC (permalink / raw)
  To: James Denholm
  Cc: Felipe Contreras, David Lang, Richard Hansen, Junio C Hamano,
	Marc Branchaud, Git Mailing List

James Denholm <nod.helm@gmail.com> writes:

> Felipe Contreras wrote:
>>David Lang wrote:
>>> the vast majority of people here do not take that attitude.
>>
>>It's actually the exact opposite. I don't care what is the track record
>>of the people in the discussion.
>
> Ah, yes, like that discussion we once had where you totally
> didn't run `git log | grep James Denholm` at one point to demonstrate
> that I had not yet made any
> contributions,instead of actually engaging in discussion. Oh,
> wait.

It's called an "ad hominem attack", and it's a very common and very
effective rhetorical device.

Cf
<URL:http://thread.gmane.org/gmane.comp.version-control.git/246598/focus=247002>

> The problem, though, is that time and time again you've
> shown that you value your own arguments to the exclusion
> of all others. You can't tell if someone else's argument is
>  good, because it runs against yours, and yours must be
> right because you hold it.

If he considered others capable of independent thought, would he call
out their imperviousness to rhetorics as a deficiency?

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  3:08         ` Felipe Contreras
@ 2014-05-04  7:49           ` Richard Hansen
  2014-05-04 10:17             ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: Richard Hansen @ 2014-05-04  7:49 UTC (permalink / raw)
  To: Felipe Contreras, Junio C Hamano, Marc Branchaud; +Cc: Git Mailing List

On 2014-05-03 23:08, Felipe Contreras wrote:
> Richard Hansen wrote:
>> Or are you proposing that pull --merge should reverse the parents if and
>> only if the remote ref is @{u}?
> 
> Only if no remote or branch are specified `git pull --merge`.

OK.  Let me summarize to make sure I understand your full proposal:

  1. if plain 'git pull', default to --ff-only
  2. if 'git pull --merge', default to --ff.  If the local branch can't
     be fast-forwarded to the upstream branch, then create a merge
     commit where the local branch is the *second* parent, not the first
  3. if 'git pull $remote [$refspec]', default to --merge --ff.  If the
     local branch can't be fast-forwarded to the remote branch, then
     create a merge commit where the remote branch is the second parent
     (the current behavior)

Is that accurate?

>> If we change 'git pull' to default to --ff-only but let 'git pull
>> $remote [$refspec]' continue to default to --ff then we have two
>> different behaviors depending on how 'git pull' is invoked.  I'm worried
>> that this would trip up users.  I'm not convinced that having two
>> different behaviors would be bad, but I'm not convinced that it would be
>> good either.
> 
> It is the only solution that has been proposed.

It's not the only proposal -- I proposed a few alternatives in my
earlier email (though not in the form of code), and others have too.  In
particular:

  * create a new 'git integrate' command/alias that behaves like 'git
    pull --no-ff'
  * change 'git pull' and 'git pull $remote [$refspec]' to do --ff-only
    by default

Another option that I just thought of:  Instead of your proposed
pull.mode and branch.<name>.pullmode, add the following two sets of configs:

  * pull.updateMode, branch.<name>.pullUpdateMode:

    The default mode to use when running 'git pull' without naming a
    remote repository or when the named remote branch is @{u}.  Valid
    options: ff-only (default), merge-ff, merge-ff-there, merge-no-ff,
    merge-no-ff-there, rebase, rebase-here, rebase-here-then-merge-no-ff

  * pull.integrateMode, branch.<name>.pullIntegrateMode:

    The default mode to use when running 'git pull $remote [$refspec]'
    when '$remote [$refspec]' is not @{u}.  Valid options are the same
    as those for pull.updateMode.  Default is merge-ff.

This gives the default split behavior as you propose, but the user can
reconfigure to suit personal preference (and we can easily change the
default for one or the other if there's too much outcry).

> 
> Moreover, while it's a bit worrisome, it wouldn't create any actual
> problems. Since `git pull $what` remains the same, there's no problems
> there. The only change would be on `git pull`.
> 
> Since most users are not going to do `git pull $what` therefore it would
> only be a small subset of users that would notice the discrepancy
> between running with $what, or not. And the only discrepancy they could
> notice is that when they run `git pull $what` they expect it to be
> --ff-only, or when the run `git pull` they don't. Only the former could
> be an issue, but even then, it's highly unlikely that `git pull $what`
> would ever be a fast-forward.
> 
> So althought conceptually it doesn't look clean, in reality there
> wouldn't be any problems.

Yes, it might not be a problem, but I'm still nervous.  I'd need more
input (e.g., user survey, broad mailing list consensus, long beta test
period, decree by a benevolent dictator) before I'd be comfortable with it.

> 
>>>>  3. integrate a more-or-less complete feature/fix back into the line
>>>>     of development it forked off of
>>>>
>>>>     In this case the local branch is a primary line of development and
>>>>     the remote branch contains the derivative work.  Think Linus
>>>>     pulling in contributions.  Different situations will call for
>>>>     different ways to handle this case, but most will probably want
>>>>     some or all of:
>>>>
>>>>      * rebase the remote commits onto local HEAD
>>>
>>> No. Most people will merge the remote branch as it is. There's no reason
>>> to rebase, specially if you are creating a merge commit.
>>
>> I disagree.  I prefer to rebase a topic branch before merging (no-ff) to
>> the main line of development for a couple of reasons:
> 
> Well that is *your* preference. Most people would prefer to preserve the
> history.

Probably.  My point is that the behavior should be configurable, and I'd
like that particular behavior to be one of the options (but not the
default -- that wouldn't be appropriate).

> 
>>   * It makes commits easier to review.
> 
> The review in the vast majority of cases happens *before* the
> integration.

True, although even when review happens before integration there is
value in making code archeology easier.

> 
> And the problem comes when the integrator makes a mistake, which they
> inevitable do (we all do), then there's no history about how the
> conflict was resolved, and what whas the original patch.

Good point, although if I was the integrator and there was a
particularly hairy conflict I'd still rebase but ask the original
contributor to review the results before merging (or ask the contributor
to rebase).

-Richard

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  6:50               ` James Denholm
  2014-05-04  7:48                 ` David Kastrup
@ 2014-05-04  9:51                 ` Felipe Contreras
  2014-05-04 10:37                   ` James Denholm
  1 sibling, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-04  9:51 UTC (permalink / raw)
  To: James Denholm, Felipe Contreras, David Lang, David Kastrup
  Cc: Richard Hansen, Junio C Hamano, Marc Branchaud, Git Mailing List

James Denholm wrote:
> Felipe Contreras wrote:
> >David Lang wrote:
> >> the vast majority of people here do not take that attitude.
> >
> >It's actually the exact opposite. I don't care what is the track record
> >of the people in the discussion.
> 
> Ah, yes, like that discussion we once had where you totally didn't run
> `git log | grep James Denholm` at one point to demonstrate that I had
> not yet made any contributions,instead of actually engaging in
> discussion. Oh, wait.

You mean this thread[1] in which I sent 14 mails directly to you? Yeah,
I din't engage in that discussion at all!

And the point I was making is that if I manage to show the community was
wrong in some thing (as you claimed), that community wouldn't include
you.

> >If their argument is good, their argument is good.
> 
> The problem, though, is that time and time again you've shown that you
> value your own arguments to the exclusion of all others. You can't
> tell if someone else's argument is good, because it runs against
> yours, and yours must be right because you hold it.

I can show you evidence of how that's a blatant lie. Just two days ago I
changed my mind because somebody provided a good argument.

But I'm not going to bother any more with you, you are just spreading
lies and tainting the discussion.

[1] http://thread.gmane.org/gmane.comp.version-control.git/247188/focus=247584

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  7:49           ` Richard Hansen
@ 2014-05-04 10:17             ` Felipe Contreras
  2014-05-04 19:09               ` Richard Hansen
  0 siblings, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-04 10:17 UTC (permalink / raw)
  To: Richard Hansen, Felipe Contreras, Junio C Hamano, Marc Branchaud
  Cc: Git Mailing List

Richard Hansen wrote:
> On 2014-05-03 23:08, Felipe Contreras wrote:
> > Richard Hansen wrote:
> >> Or are you proposing that pull --merge should reverse the parents if and
> >> only if the remote ref is @{u}?
> > 
> > Only if no remote or branch are specified `git pull --merge`.
> 
> OK.  Let me summarize to make sure I understand your full proposal:
> 
>   1. if plain 'git pull', default to --ff-only
>   2. if 'git pull --merge', default to --ff.  If the local branch can't
>      be fast-forwarded to the upstream branch, then create a merge
>      commit where the local branch is the *second* parent, not the first
>   3. if 'git pull $remote [$refspec]', default to --merge --ff.  If the
>      local branch can't be fast-forwarded to the remote branch, then
>      create a merge commit where the remote branch is the second parent
>      (the current behavior)
> 
> Is that accurate?

Yes, that is accurate. Note that 3. is the current behavior.

> >> If we change 'git pull' to default to --ff-only but let 'git pull
> >> $remote [$refspec]' continue to default to --ff then we have two
> >> different behaviors depending on how 'git pull' is invoked.  I'm worried
> >> that this would trip up users.  I'm not convinced that having two
> >> different behaviors would be bad, but I'm not convinced that it would be
> >> good either.
> > 
> > It is the only solution that has been proposed.
> 
> It's not the only proposal -- I proposed a few alternatives in my
> earlier email (though not in the form of code), and others have too.  In
> particular:
> 
>   * create a new 'git integrate' command/alias that behaves like 'git
>     pull --no-ff'

Yeah but that's for a different issue altogheter. I doesn't solve the
problems in 1. nor 2. nor 3.

>   * change 'git pull' and 'git pull $remote [$refspec]' to do --ff-only
>     by default
> 
> Another option that I just thought of:  Instead of your proposed
> pull.mode and branch.<name>.pullmode, add the following two sets of configs:
> 
>   * pull.updateMode, branch.<name>.pullUpdateMode:
> 
>     The default mode to use when running 'git pull' without naming a
>     remote repository or when the named remote branch is @{u}.  Valid
>     options: ff-only (default), merge-ff, merge-ff-there, merge-no-ff,
>     merge-no-ff-there, rebase, rebase-here, rebase-here-then-merge-no-ff

Those are way too many options to be able to sensibly explain them.

>   * pull.integrateMode, branch.<name>.pullIntegrateMode:
> 
>     The default mode to use when running 'git pull $remote [$refspec]'
>     when '$remote [$refspec]' is not @{u}.  Valid options are the same
>     as those for pull.updateMode.  Default is merge-ff.
> 
> This gives the default split behavior as you propose, but the user can
> reconfigure to suit personal preference (and we can easily change the
> default for one or the other if there's too much outcry).

If we reduce the number of options to begin with (more can be added
later), then it might make sense to have these two options.

However, that doesn't change the proposal you described above (1. 2.
3.).

> > Moreover, while it's a bit worrisome, it wouldn't create any actual
> > problems. Since `git pull $what` remains the same, there's no problems
> > there. The only change would be on `git pull`.
> > 
> > Since most users are not going to do `git pull $what` therefore it would
> > only be a small subset of users that would notice the discrepancy
> > between running with $what, or not. And the only discrepancy they could
> > notice is that when they run `git pull $what` they expect it to be
> > --ff-only, or when the run `git pull` they don't. Only the former could
> > be an issue, but even then, it's highly unlikely that `git pull $what`
> > would ever be a fast-forward.
> > 
> > So althought conceptually it doesn't look clean, in reality there
> > wouldn't be any problems.
> 
> Yes, it might not be a problem, but I'm still nervous.  I'd need more
> input (e.g., user survey, broad mailing list consensus, long beta test
> period, decree by a benevolent dictator) before I'd be comfortable with it.

The user surveys are not happening any more. The results were ignored by
the developers anyway.

Mailing list consensus might be possible, but that wouldn't tell us
much.

There's something we can do, and let me clarify my proposal. What you
described above is what I think should happen eventually, however, we
can start by doing something like what my patch series is doing; issue a
warning that the merge is not fast-forward and things might change in
the future.

If people find this behavior confusing they will complain in the mailing
list. Although I suspect it would be for other reasons, not the 'git
pull'/'git pull $there' division. Either way we would see in the
discussion.

> >>>>  3. integrate a more-or-less complete feature/fix back into the line
> >>>>     of development it forked off of
> >>>>
> >>>>     In this case the local branch is a primary line of development and
> >>>>     the remote branch contains the derivative work.  Think Linus
> >>>>     pulling in contributions.  Different situations will call for
> >>>>     different ways to handle this case, but most will probably want
> >>>>     some or all of:
> >>>>
> >>>>      * rebase the remote commits onto local HEAD
> >>>
> >>> No. Most people will merge the remote branch as it is. There's no reason
> >>> to rebase, specially if you are creating a merge commit.
> >>
> >> I disagree.  I prefer to rebase a topic branch before merging (no-ff) to
> >> the main line of development for a couple of reasons:
> > 
> > Well that is *your* preference. Most people would prefer to preserve the
> > history.
> 
> Probably.  My point is that the behavior should be configurable, and I'd
> like that particular behavior to be one of the options (but not the
> default -- that wouldn't be appropriate).

All right. But I'm a bit overwhelmed by all the things to keep in mind.
Does your proposed IntegradeMode/UpdateMode deal with this?

I will try to gather a bunch of discussions and create a new thread to
summrize what is probably the best, and Intage/Update mode is as far as
I'm willing to go into considering options.

> >>   * It makes commits easier to review.
> > 
> > The review in the vast majority of cases happens *before* the
> > integration.
> 
> True, although even when review happens before integration there is
> value in making code archeology easier.

I think I explained below why "code archeology" is better served by
preserving the history.

> > And the problem comes when the integrator makes a mistake, which they
> > inevitable do (we all do), then there's no history about how the
> > conflict was resolved, and what whas the original patch.
> 
> Good point, although if I was the integrator and there was a
> particularly hairy conflict I'd still rebase but ask the original
> contributor to review the results before merging (or ask the contributor
> to rebase).

Sure, asking the contributor to rebase is best. However, sending the
rebase results is not that useful; the contributor would like to see
what actually changed so an interdiff might be more than enough. But
then that's basically the same as reviewing the merge commit.

Anyway, I'll try to grab what I can from previous discussions (mainly
about switching the merge parents) and create a new thread with a
summary.

Cheers.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04  9:51                 ` Felipe Contreras
@ 2014-05-04 10:37                   ` James Denholm
  2014-05-04 11:02                     ` David Kastrup
  0 siblings, 1 reply; 50+ messages in thread
From: James Denholm @ 2014-05-04 10:37 UTC (permalink / raw)
  To: Felipe Contreras, David Lang, David Kastrup
  Cc: Richard Hansen, Junio C Hamano, Marc Branchaud, Git Mailing List

On 4 May 2014 19:51:09 GMT+10:00, Felipe Contreras <felipe.contreras@gmail.com> wrote:
>James Denholm wrote:
>> Felipe Contreras wrote:
>> >David Lang wrote:
>> >> the vast majority of people here do not take that attitude.
>> >
>> >It's actually the exact opposite. I don't care what is the track
>record
>> >of the people in the discussion.
>> 
>> Ah, yes, like that discussion we once had where you totally didn't
>run
>> `git log | grep James Denholm` at one point to demonstrate that I had
>> not yet made any contributions,instead of actually engaging in
>> discussion. Oh, wait.
>
>You mean this thread[1] in which I sent 14 mails directly to you? Yeah,
>I din't engage in that discussion at all!

Yeah, you didn't. Instead you danced, but I guess it's
really all said and done now so eh, have your point.

>> >If their argument is good, their argument is good.
>> 
>> The problem, though, is that time and time again you've shown that
>you
>> value your own arguments to the exclusion of all others. You can't
>> tell if someone else's argument is good, because it runs against
>> yours, and yours must be right because you hold it.
>
>I can show you evidence of how that's a blatant lie. Just two days ago
>I
>changed my mind because somebody provided a good argument.

And I can show you evidence of you being
indiscourseable on the topic of your pet proposals,
but I won't, because you're indiscourseable on the
meta similarly.

>But I'm not going to bother any more with you, you are just spreading
>lies and tainting the discussion.

Well, maybe we'll see what other folks think.

Regards,
James Denholm.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04 10:37                   ` James Denholm
@ 2014-05-04 11:02                     ` David Kastrup
  0 siblings, 0 replies; 50+ messages in thread
From: David Kastrup @ 2014-05-04 11:02 UTC (permalink / raw)
  To: James Denholm
  Cc: Felipe Contreras, David Lang, Richard Hansen, Junio C Hamano,
	Marc Branchaud, Git Mailing List

James Denholm <nod.helm@gmail.com> writes:

> On 4 May 2014 19:51:09 GMT+10:00, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>
>>But I'm not going to bother any more with you, you are just spreading
>>lies and tainting the discussion.
>
> Well, maybe we'll see what other folks think.

According to whose summary?

<URL:https://www.youtube.com/watch?v=2eMkth8FWno>

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04 10:17             ` Felipe Contreras
@ 2014-05-04 19:09               ` Richard Hansen
  2014-05-04 21:13                 ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: Richard Hansen @ 2014-05-04 19:09 UTC (permalink / raw)
  To: Felipe Contreras, Junio C Hamano, Marc Branchaud; +Cc: Git Mailing List

On 2014-05-04 06:17, Felipe Contreras wrote:
> Richard Hansen wrote:
>> On 2014-05-03 23:08, Felipe Contreras wrote:
>>> It is the only solution that has been proposed.
>>
>> It's not the only proposal -- I proposed a few alternatives in my
>> earlier email (though not in the form of code), and others have too.  In
>> particular:
>>
>>   * create a new 'git integrate' command/alias that behaves like 'git
>>     pull --no-ff'
> 
> Yeah but that's for a different issue altogheter. I doesn't solve the
> problems in 1. nor 2. nor 3.

'git integrate' would handle usage cases #2 (update a published branch
to its "parent" branch) and #3 (integrate a completed task into the main
line of development), making it feasible to change 'git pull' and 'git
pull $remote [$refspec]' to default to --ff-only to handle usage case #1
(update local branch to @{u}).

> 
>>   * change 'git pull' and 'git pull $remote [$refspec]' to do --ff-only
>>     by default
>>
>> Another option that I just thought of:  Instead of your proposed
>> pull.mode and branch.<name>.pullmode, add the following two sets of configs:
>>
>>   * pull.updateMode, branch.<name>.pullUpdateMode:
>>
>>     The default mode to use when running 'git pull' without naming a
>>     remote repository or when the named remote branch is @{u}.  Valid
>>     options: ff-only (default), merge-ff, merge-ff-there, merge-no-ff,
>>     merge-no-ff-there, rebase, rebase-here, rebase-here-then-merge-no-ff
> 
> Those are way too many options to be able to sensibly explain them.

Certainly this is too many options for a first patch series, but I don't
think they're unexplainable.  (I listed a bunch of options because I was
trying to envision where this might take us in the long run.)

For the first patch series, I'd expect:  merge (which uses the merge.ff
option to determine whether to ff, ff-only, or no-ff), rebase, and ff-only.

Later ff-only would be made the default.

Later some or all of the other options would be added depending on user
interest.

> 
>>   * pull.integrateMode, branch.<name>.pullIntegrateMode:
>>
>>     The default mode to use when running 'git pull $remote [$refspec]'
>>     when '$remote [$refspec]' is not @{u}.  Valid options are the same
>>     as those for pull.updateMode.  Default is merge-ff.
>>
>> This gives the default split behavior as you propose, but the user can
>> reconfigure to suit personal preference (and we can easily change the
>> default for one or the other if there's too much outcry).
> 
> If we reduce the number of options to begin with (more can be added
> later),

yup

> then it might make sense to have these two options.
> 
> However, that doesn't change the proposal you described above (1. 2.
> 3.).

Not sure what you mean.  I oulined three usage cases:
  #1 update local branch to @{u}
  #2 update a published branch to its "parent" branch
  #3 integrate a completed task into the main line of development

Having these two sets of options (updateMode and integrateMode) would
make it possible to configure plain 'git pull' to handle usage case #1
and 'git pull $remote [$refspec]' to handle usage cases #2 and #3.

Or the user could configure 'git pull' and 'git pull $remote [$refspec]'
to behave the same, in case they find the different behaviors to be too
confusing.

> There's something we can do, and let me clarify my proposal. What you
> described above is what I think should happen eventually, however, we
> can start by doing something like what my patch series is doing; issue a
> warning that the merge is not fast-forward and things might change in
> the future.

OK, let me rephrase to make sure I understand:

  1. leave the default behavior as-is for now (merge with local
     branch the first parent)
  2. add --merge argument
  3. add ff-only setting
  4. plan to eventually change the plain 'git pull' default to ff-only,
     but don't change the default yet
  5. add a warning if the plain 'git pull' is a non-ff
  6. wait and see how users react.  If they're OK with it, switch the
     default of the plain 'git pull' to ff-only.

Is that accurate?  If so, sounds OK to me.

> 
> If people find this behavior confusing they will complain in the mailing
> list.

true

> Although I suspect it would be for other reasons, not the 'git
> pull'/'git pull $there' division.

probably

> Either way we would see in the discussion.

sounds good to me

> 
>>>>>>  3. integrate a more-or-less complete feature/fix back into the line
>>>>>>     of development it forked off of
>>>>>>
>>>>>>     In this case the local branch is a primary line of development and
>>>>>>     the remote branch contains the derivative work.  Think Linus
>>>>>>     pulling in contributions.  Different situations will call for
>>>>>>     different ways to handle this case, but most will probably want
>>>>>>     some or all of:
>>>>>>
>>>>>>      * rebase the remote commits onto local HEAD
>>>>>
>>>>> No. Most people will merge the remote branch as it is. There's no reason
>>>>> to rebase, specially if you are creating a merge commit.
>>>>
>>>> I disagree.  I prefer to rebase a topic branch before merging (no-ff) to
>>>> the main line of development for a couple of reasons:
>>>
>>> Well that is *your* preference. Most people would prefer to preserve the
>>> history.
>>
>> Probably.  My point is that the behavior should be configurable, and I'd
>> like that particular behavior to be one of the options (but not the
>> default -- that wouldn't be appropriate).
> 
> All right. But I'm a bit overwhelmed by all the things to keep in mind.

Sure, this would be an option to add later.

> Does your proposed IntegradeMode/UpdateMode deal with this?

mode = rebase-here-then-merge-no-ff would do what I described

> Anyway, I'll try to grab what I can from previous discussions (mainly
> about switching the merge parents) and create a new thread with a
> summary.

That would be nice, thanks.

-Richard

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04 19:09               ` Richard Hansen
@ 2014-05-04 21:13                 ` Felipe Contreras
  2014-05-05  5:44                   ` Richard Hansen
  0 siblings, 1 reply; 50+ messages in thread
From: Felipe Contreras @ 2014-05-04 21:13 UTC (permalink / raw)
  To: Richard Hansen, Felipe Contreras, Junio C Hamano, Marc Branchaud
  Cc: Git Mailing List

Richard Hansen wrote:
> On 2014-05-04 06:17, Felipe Contreras wrote:
> > Richard Hansen wrote:
> >> On 2014-05-03 23:08, Felipe Contreras wrote:
> >>> It is the only solution that has been proposed.
> >>
> >> It's not the only proposal -- I proposed a few alternatives in my
> >> earlier email (though not in the form of code), and others have too.  In
> >> particular:
> >>
> >>   * create a new 'git integrate' command/alias that behaves like 'git
> >>     pull --no-ff'
> > 
> > Yeah but that's for a different issue altogheter. I doesn't solve the
> > problems in 1. nor 2. nor 3.
> 
> 'git integrate' would handle usage cases #2 (update a published branch
> to its "parent" branch) and #3 (integrate a completed task into the main
> line of development),

But these cases are completely different. One should reverse the
parents, the other one not.

I feel if a new command is to be added, it should be the one that is
introducing the brand new behavior: switching the parents. So it would
be appropriate for 1. and 2.

> >>   * change 'git pull' and 'git pull $remote [$refspec]' to do --ff-only
> >>     by default
> >>
> >> Another option that I just thought of:  Instead of your proposed
> >> pull.mode and branch.<name>.pullmode, add the following two sets of configs:
> >>
> >>   * pull.updateMode, branch.<name>.pullUpdateMode:
> >>
> >>     The default mode to use when running 'git pull' without naming a
> >>     remote repository or when the named remote branch is @{u}.  Valid
> >>     options: ff-only (default), merge-ff, merge-ff-there, merge-no-ff,
> >>     merge-no-ff-there, rebase, rebase-here, rebase-here-then-merge-no-ff
> > 
> > Those are way too many options to be able to sensibly explain them.
> 
> Certainly this is too many options for a first patch series, but I don't
> think they're unexplainable.  (I listed a bunch of options because I was
> trying to envision where this might take us in the long run.)

Actually I think they are too many for any point in time.

Maybe pull.updateArgs would make more sense.

> For the first patch series, I'd expect:  merge (which uses the merge.ff
> option to determine whether to ff, ff-only, or no-ff), rebase, and ff-only.

Seems sensible.

> > then it might make sense to have these two options.
> > 
> > However, that doesn't change the proposal you described above (1. 2.
> > 3.).
> 
> Not sure what you mean.  I oulined three usage cases:
>   #1 update local branch to @{u}
>   #2 update a published branch to its "parent" branch
>   #3 integrate a completed task into the main line of development
> 
> Having these two sets of options (updateMode and integrateMode) would
> make it possible to configure plain 'git pull' to handle usage case #1
> and 'git pull $remote [$refspec]' to handle usage cases #2 and #3.

Not if by default they are already handled.

> > There's something we can do, and let me clarify my proposal. What you
> > described above is what I think should happen eventually, however, we
> > can start by doing something like what my patch series is doing; issue a
> > warning that the merge is not fast-forward and things might change in
> > the future.
> 
> OK, let me rephrase to make sure I understand:
> 
>   1. leave the default behavior as-is for now (merge with local
>      branch the first parent)
>   2. add --merge argument
>   3. add ff-only setting
>   4. plan to eventually change the plain 'git pull' default to ff-only,
>      but don't change the default yet
>   5. add a warning if the plain 'git pull' is a non-ff
>   6. wait and see how users react.  If they're OK with it, switch the
>      default of the plain 'git pull' to ff-only.
> 
> Is that accurate?  If so, sounds OK to me.

That is what my patch series is doing already, basically.

The new warning I'm proposing would be for the split behavior of 'git
merge' and 'git merge $there'. Which is what is worrysome.

> mode = rebase-here-then-merge-no-ff would do what I described

I think that mode is way too specific to be useful for most people.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-04 21:13                 ` Felipe Contreras
@ 2014-05-05  5:44                   ` Richard Hansen
  2014-05-05  5:47                     ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: Richard Hansen @ 2014-05-05  5:44 UTC (permalink / raw)
  To: Felipe Contreras, Junio C Hamano, Marc Branchaud; +Cc: Git Mailing List

On 2014-05-04 17:13, Felipe Contreras wrote:
> Richard Hansen wrote:
>> On 2014-05-04 06:17, Felipe Contreras wrote:
>>> Richard Hansen wrote:
>>>> On 2014-05-03 23:08, Felipe Contreras wrote:
>>>>> It is the only solution that has been proposed.
>>>>
>>>> It's not the only proposal -- I proposed a few alternatives in my
>>>> earlier email (though not in the form of code), and others have too.  In
>>>> particular:
>>>>
>>>>   * create a new 'git integrate' command/alias that behaves like 'git
>>>>     pull --no-ff'
>>>
>>> Yeah but that's for a different issue altogheter. I doesn't solve the
>>> problems in 1. nor 2. nor 3.
>>
>> 'git integrate' would handle usage cases #2 (update a published branch
>> to its "parent" branch) and #3 (integrate a completed task into the main
>> line of development),
> 
> But these cases are completely different. One should reverse the
> parents, the other one not.

No -- for both #2 and #3 I want the remote branch to be merged into the
local branch.

In the example I gave for use case #2, foo is a local branch with
origin/foo as the configured upstream and origin/foo was forked off of
origin/master.  Someone pushed new stuff to origin/master, and the user
wants the new stuff to also be in origin/foo.  So the user does this:

  git checkout foo
  git pull --ff-only  # this is use case #1
  git pull origin master  # this is use case #2
  git push

The merge commit created by 'git pull origin master' should have
origin/master as the second parent, not the first.

-Richard

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-05  5:44                   ` Richard Hansen
@ 2014-05-05  5:47                     ` Felipe Contreras
  0 siblings, 0 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-05  5:47 UTC (permalink / raw)
  To: Richard Hansen, Felipe Contreras, Junio C Hamano, Marc Branchaud
  Cc: Git Mailing List

Richard Hansen wrote:
> On 2014-05-04 17:13, Felipe Contreras wrote:
> > Richard Hansen wrote:
> >> On 2014-05-04 06:17, Felipe Contreras wrote:
> >>> Richard Hansen wrote:
> >>>> On 2014-05-03 23:08, Felipe Contreras wrote:
> >>>>> It is the only solution that has been proposed.
> >>>>
> >>>> It's not the only proposal -- I proposed a few alternatives in my
> >>>> earlier email (though not in the form of code), and others have too.  In
> >>>> particular:
> >>>>
> >>>>   * create a new 'git integrate' command/alias that behaves like 'git
> >>>>     pull --no-ff'
> >>>
> >>> Yeah but that's for a different issue altogheter. I doesn't solve the
> >>> problems in 1. nor 2. nor 3.
> >>
> >> 'git integrate' would handle usage cases #2 (update a published branch
> >> to its "parent" branch) and #3 (integrate a completed task into the main
> >> line of development),
> > 
> > But these cases are completely different. One should reverse the
> > parents, the other one not.
> 
> No -- for both #2 and #3 I want the remote branch to be merged into the
> local branch.

I didn't mean #2 and #3, I meant (#1) vs. (#2, #3).

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03 10:00   ` John Szakmeister
@ 2014-05-05 15:39     ` Richard Hansen
  2014-05-05 18:15       ` Felipe Contreras
  0 siblings, 1 reply; 50+ messages in thread
From: Richard Hansen @ 2014-05-05 15:39 UTC (permalink / raw)
  To: John Szakmeister; +Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

On 2014-05-03 06:00, John Szakmeister wrote:
> FWIW, at my company, we took another approach.  We introduced a `git
> ffwd` command that fetches from all remotes, and fast-forwards all
> your local branches that are tracking a remote, and everyone on the
> team uses it all the time.  It should be said this team also likes to
> use Git bare-metal, because they like knowing how things work
> out-of-the-box.  But they all use the command because it's so
> convenient.

I also wrote a script to fast-forward all local branches to their
configured upstream refs.  I finally got around to uploading it
somewhere public:

   https://github.com/richardhansen/git-update-branch

I use it in my 'git up' alias:

   git config --global alias.up \
       '!git remote update -p; git update-branch -a'

If there's interest I can tweak the style to conform to
Documentation/CodingGuidelines and stick it in contrib/ or something.

-Richard

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-05 15:39     ` Richard Hansen
@ 2014-05-05 18:15       ` Felipe Contreras
  0 siblings, 0 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-05 18:15 UTC (permalink / raw)
  To: Richard Hansen, John Szakmeister
  Cc: Junio C Hamano, Marc Branchaud, Git Mailing List

Richard Hansen wrote:
> On 2014-05-03 06:00, John Szakmeister wrote:
> > FWIW, at my company, we took another approach.  We introduced a `git
> > ffwd` command that fetches from all remotes, and fast-forwards all
> > your local branches that are tracking a remote, and everyone on the
> > team uses it all the time.  It should be said this team also likes to
> > use Git bare-metal, because they like knowing how things work
> > out-of-the-box.  But they all use the command because it's so
> > convenient.
> 
> I also wrote a script to fast-forward all local branches to their
> configured upstream refs.  I finally got around to uploading it
> somewhere public:
> 
>    https://github.com/richardhansen/git-update-branch
> 
> I use it in my 'git up' alias:
> 
>    git config --global alias.up \
>        '!git remote update -p; git update-branch -a'
> 
> If there's interest I can tweak the style to conform to
> Documentation/CodingGuidelines and stick it in contrib/ or something.

I think this would fit perfectly in the proposed `git update` command as
an option: `git update --all`.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 21:48     ` Jeff King
  2014-05-02 21:55       ` Felipe Contreras
  2014-05-03  2:18       ` David Kastrup
@ 2014-05-06 22:06       ` Junio C Hamano
  2014-05-06 22:19         ` Felipe Contreras
  2 siblings, 1 reply; 50+ messages in thread
From: Junio C Hamano @ 2014-05-06 22:06 UTC (permalink / raw)
  To: Jeff King; +Cc: Felipe Contreras, Marc Branchaud, Git Mailing List

Jeff King <peff@peff.net> writes:

> I realize this has veered off into talking about an "update" command,
> and not necessarily "pull", but since there a lot of proposals floating
> around, I wanted to make one point: if we are going to do such a switch,
> let's please make it something the user explicitly turns on.

I mentioned "update" in an attempt to suggest some way to avoid
breaking "git pull" for people who do want to advane the history
with real work (i.e. not just following along with fast-forwarding).

A failed "git push" that suggests to pull first, which came from the
original "To emulate CVS workflow, you can pull, work, push, and if
the push fails, pull again and then push" in the early tutorial,
turns out to be very bad in the "trunk" centric worldview.
And I think the solution is to realize that we use "git pull" for
two fairly differnt workflows.

 - You know you own the tip of the "trunk" (in the global view).
   You merge from other people to advance the global world view in a
   way that makes sense in the "first-parent chain is the trunk"
   worldview.  That is what "git pull [--no-ff]" was designed to do,
   and it does it very well.

 - You have some work of yours (either you committed directly, you
   merged your own work done on a side branch, or you merged from
   other people using "git pull") on top of a commit that used to be
   at the tip of the global world.  You want to make sure that
   branch you are on is not missing what has happened while you are
   not communicating with the outside world.

The problematic case is the latter, and by introducing a new command
to do that well (which is *not* just about "swapping the order of
the parents", by the way), updating the "leaf developer" section of
"Everyday Git" document and tutorials, and suggesting to use that
upon failed "git push", I think users would get a more pleasant
experience.  And move "git pull" into "integrator" section, a
command that is not necessary for leaf developers.

I am not married to the name "update".  I think the ideal behaviour
of that "leaf-developer" command would be something along the lines
of the following:

 - If we can fast-forward, do so and we are done.

 - Otherwise, we have a history of this shape:

        ----O    
             \
    -----A----B----C
          \
           X---Y---Z

   where A was where we forked, B was a merge the user made, C was a
   commit the user directly made, and X, Y, and Z (some of them may
   be merges) are the "trunk" history  "git pull" would create a
   merge M whose parents are <C Z>, which is wrong from the
   "first-parent is the trunk" worldview.

   But recording the merge to have parents <Z C> does not give us
   "the first-parent is the trunk" worldview, in the presense of B.
   We would prefer to end up with a history more like this:

    -----A       ----O
          \           \
           X---Y---Z---B'--C'

   so that your work, your contribution with two commits of yours,
   was to merge the work done on a side branch and then made one
   commit directly on top of it.

   Hence, I think the ideal behaviour of the new command is to
   replay the first-parent history on top of the updated tip of your
   upstream (which by the way is different from how "rebase
   --preserve-merges" works; it is more like how J6t wanted to make
   "rebase --preserve-merges" work, IIRC).

After that, you can attempt to push, and it may fail again (because
somebody has grown the shared history to have a child W of Z at the
tip), in which case exactly the same "git update" would attempt to
recreate a history of this shape:

    -----A           ----O
          \               \
           X---Y---Z---W---B"--C"


During a long transition period (essentially, waiting for the
current crop of documents and tutorials to die out), we will need
extra safety to prevent people, who merely wanted to bring their
branch up to date, from running "git pull", and I think the command
needs to:

 - check which branch of what repository it is trying to pull;

 - check which branch of what repository it is going to update if
   "git push" is given;

 - if they are the same, then you are attempting to update from your
   upstream, so either warn or error out.  If we are going to warn
   but make a merge anyway, the warning message *must* come at the
   very end of the output (and tell the user the way to recover is
   to reset one away and run the other command).

Or something like that.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-06 22:06       ` Junio C Hamano
@ 2014-05-06 22:19         ` Felipe Contreras
  0 siblings, 0 replies; 50+ messages in thread
From: Felipe Contreras @ 2014-05-06 22:19 UTC (permalink / raw)
  To: Junio C Hamano, Jeff King
  Cc: Felipe Contreras, Marc Branchaud, Git Mailing List

Junio C Hamano wrote:
>    But recording the merge to have parents <Z C> does not give us
>    "the first-parent is the trunk" worldview, in the presense of B.
>    We would prefer to end up with a history more like this:
> 
>     -----A       ----O
>           \           \
>            X---Y---Z---B'--C'
> 
>    so that your work, your contribution with two commits of yours,
>    was to merge the work done on a side branch and then made one
>    commit directly on top of it.

Yes, _ideally_, but as it has been explained multiple times most Git
beginners have no idea what is a rebase.

We might evenaully do this by default, but first we should start
rejecting the update by default and recommending `git update --merge` as
it has been discussed quite a lot should be the behavior of `git pull`.

>    Hence, I think the ideal behaviour of the new command is to
>    replay the first-parent history on top of the updated tip of your
>    upstream (which by the way is different from how "rebase
>    --preserve-merges" works; it is more like how J6t wanted to make
>    "rebase --preserve-merges" work, IIRC).

What is the difference with 'rebase -p'?

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-03  7:56   ` Richard Hansen
  2014-05-03  8:17     ` David Kastrup
  2014-05-03  9:26     ` Felipe Contreras
@ 2014-05-07 22:37     ` Max Kirillov
  2 siblings, 0 replies; 50+ messages in thread
From: Max Kirillov @ 2014-05-07 22:37 UTC (permalink / raw)
  To: Richard Hansen
  Cc: Junio C Hamano, Felipe Contreras, Marc Branchaud, Git Mailing List

Hi.

I might be late to this discussion, but here either
something I don't understand or something is missed.

On Sat, May 03, 2014 at 03:56:51AM -0400, Richard Hansen wrote:
> In my experience 'git pull' is mostly (only?) used for the following
> three tasks:
> 
>  1. update a local branch to incorporate the latest upstream changes
> 
>     In this case, the local branch (master) is a
>     derivative of the upstream branch (origin/master).
>     The user wants all of the commits in the remote branch
>     to be in the local branch.  And the user would like
>     the local changes, if any, to descend from the tip of
>     the remote branch.
> 
>     For this case, 'git pull --ff-only' followed by 'git
>     rebase -p' works well, as does 'git pull
>     --rebase=preserve' if the user is comfortable rebasing
>     without reviewing the incoming commits first.  A plain
>     'git pull' or 'git pull --ff' is suboptimal due to the
>     awkward backwards-parents merge commit.

This is actually not a finally defined use case. What kind
of "local changes" user can have ahead of the remote? As
far I understand, there are 3 cases:

 1a. Changes that are going to be merged back to the master,
     but not yet ready to be there.

This is essentially the same as case 2, but it does not name
the development branch explicitely. Switching parents for
this case is not desirable.

 1b. Some truly local changes which never goes anywhere.

For this case the parent order does not matter.

 1c. The local changes prepared for integration, but instead
     of filing a pull request of otherwise publishing the
     branch for integrator, the leaf developer does the
     integrator's job and merges it back to master and then
     publishing the master.

As far as I understand, this is the only case when somebody
would want the parents to be switched. And this does not
seem to be a good practice, because it's prone to push races
and requires letting everyone to push to master. So maybe
git should not encourage people to do so.

And the name "update", proposed here, does not seem to be
correct. Because what happens is not updating, but merging
feature to master and closing it.

>  2. update a published feature branch with the latest
>     changes from its parent branch

>  3. integrate a more-or-less complete feature/fix back
>     into the line of development it forked off of

-- 
Max

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: Pull is Mostly Evil
  2014-05-02 15:37 Pull is Mostly Evil Marc Branchaud
                   ` (2 preceding siblings ...)
  2014-05-02 22:12 ` Philip Oakley
@ 2014-05-09 19:49 ` Marc Branchaud
  3 siblings, 0 replies; 50+ messages in thread
From: Marc Branchaud @ 2014-05-09 19:49 UTC (permalink / raw)
  To: Git Mailing List

After poking this hornet's nest I pretty much have stood back and not
participated in the ensuing discussions.  But having unleashed the hornets I
feel I should at least say something, if only to assure people that I'm not
ignoring their plight.

There have been various proposals to modify git-pull's defaults, and/or
extend it with new configuration settings, and/or add a new command.  As I
don't use "git pull" I feel I'm not in any position to comment about the
particulars of these proposals.

However I remain skeptical that these proposals, in any form, will really be
all that helpful to new users.  That's because in order to know whether or
not "git pull" (or "git update") does what the user wants, the user has to
understand the intricacies of both their own workflow and how git can work
within that workflow.  By the time a user gains that understanding, she is no
longer a new user.

Still, I do think the pull command is useful.  In particular I think that a
project can benefit greatly by tailoring pull's behaviour to match its
workflow, and that a project's participants can be told how to configure git
so that pull works properly for that project.  Maybe even such configuration
-- a "workflow blueprint" if you will -- can be tracked inside the project
itself, so that a fresh project clone can automatically have "git pull"
properly configured.   To me this seems like a fabulous feature for git.

But for now I go back to what I said before:  Give "git pull" enough knobs to
let people tailor it to their individual projects' needs.  But also disable
"git pull" by default, because nobody should run it until they've considered
how they want it to work.

		M.

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2014-05-09 19:49 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-02 15:37 Pull is Mostly Evil Marc Branchaud
2014-05-02 15:45 ` David Kastrup
2014-05-02 16:05   ` Philip Oakley
2014-05-02 19:05     ` Felipe Contreras
2014-05-02 22:34       ` Philip Oakley
2014-05-02 22:53         ` Jonathan Nieder
2014-05-03 20:24           ` Philip Oakley
2014-05-02 23:23         ` Felipe Contreras
2014-05-03 11:24           ` Philip Oakley
2014-05-03 11:30             ` Felipe Contreras
2014-05-02 19:31   ` David Lang
2014-05-02 19:37     ` David Kastrup
2014-05-02 18:13 ` Junio C Hamano
2014-05-02 19:11   ` Felipe Contreras
2014-05-02 20:06     ` Junio C Hamano
2014-05-02 20:58       ` Felipe Contreras
2014-05-02 21:48     ` Jeff King
2014-05-02 21:55       ` Felipe Contreras
2014-05-02 22:36         ` Jeff King
2014-05-02 23:27           ` Felipe Contreras
2014-05-03  2:18       ` David Kastrup
2014-05-06 22:06       ` Junio C Hamano
2014-05-06 22:19         ` Felipe Contreras
2014-05-03  7:56   ` Richard Hansen
2014-05-03  8:17     ` David Kastrup
2014-05-03  9:04       ` Felipe Contreras
2014-05-03  9:56         ` David Kastrup
2014-05-04  4:30           ` David Lang
2014-05-04  4:38             ` Felipe Contreras
2014-05-04  6:13               ` David Kastrup
2014-05-04  6:50               ` James Denholm
2014-05-04  7:48                 ` David Kastrup
2014-05-04  9:51                 ` Felipe Contreras
2014-05-04 10:37                   ` James Denholm
2014-05-04 11:02                     ` David Kastrup
2014-05-03  9:26     ` Felipe Contreras
2014-05-03 22:09       ` Richard Hansen
2014-05-04  3:08         ` Felipe Contreras
2014-05-04  7:49           ` Richard Hansen
2014-05-04 10:17             ` Felipe Contreras
2014-05-04 19:09               ` Richard Hansen
2014-05-04 21:13                 ` Felipe Contreras
2014-05-05  5:44                   ` Richard Hansen
2014-05-05  5:47                     ` Felipe Contreras
2014-05-07 22:37     ` Max Kirillov
2014-05-03 10:00   ` John Szakmeister
2014-05-05 15:39     ` Richard Hansen
2014-05-05 18:15       ` Felipe Contreras
2014-05-02 22:12 ` Philip Oakley
2014-05-09 19:49 ` Marc Branchaud

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).