All of lore.kernel.org
 help / color / mirror / Atom feed
* git pull with "no common commits" : danger?
@ 2010-04-08  1:56 Aghiles
  2010-04-08  2:08 ` Michael J Gruber
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Aghiles @ 2010-04-08  1:56 UTC (permalink / raw)
  To: git list

Hello,

I mistakenly pulled a project into another project. I had the
"warning: no common commits" but the pull did proceed.
I am wondering if, from a usability point of view, it would be
best to avoid doing so by default.

Thanks,

  -- aghiles

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

* Re: git pull with "no common commits" : danger?
  2010-04-08  1:56 git pull with "no common commits" : danger? Aghiles
@ 2010-04-08  2:08 ` Michael J Gruber
  2010-04-08  2:43   ` Aghiles
  2010-04-08  5:44 ` Jonathan Nieder
  2010-04-08  6:20 ` Junio C Hamano
  2 siblings, 1 reply; 7+ messages in thread
From: Michael J Gruber @ 2010-04-08  2:08 UTC (permalink / raw)
  To: Aghiles; +Cc: git list

Aghiles venit, vidit, dixit 08.04.2010 09:56:
> Hello,
> 
> I mistakenly pulled a project into another project. I had the
> "warning: no common commits" but the pull did proceed.
> I am wondering if, from a usability point of view, it would be
> best to avoid doing so by default.

Puleeezze: No animals were harmed during the process, right? I mean, no
data loss, all you have to do is a git reset. Let's try and not make Git
into "Are you sure"dom.

Michael

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

* Re: git pull with "no common commits" : danger?
  2010-04-08  2:08 ` Michael J Gruber
@ 2010-04-08  2:43   ` Aghiles
  0 siblings, 0 replies; 7+ messages in thread
From: Aghiles @ 2010-04-08  2:43 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git list

> Aghiles venit, vidit, dixit 08.04.2010 09:56:
>> Hello,
>>
>> I mistakenly pulled a project into another project. I had the
>> "warning: no common commits" but the pull did proceed.
>> I am wondering if, from a usability point of view, it would be
>> best to avoid doing so by default.
>
> Puleeezze: No animals were harmed during the process, right? I mean, no
> data loss, all you have to do is a git reset. Let's try and not make Git
> into "Are you sure"dom.

How many times did you see that message? If you saw it, it was probably a
mistake. I think that it is a safe bet to assume that whoever does that won't
complain to type something like: git pull --no-common-commits-ok

I manage many git projects and this happens from time to time, mainly
because of tiredness. I simply consider the proposed behaviour more
natural.

Git is not the bare bone tool set anymore, it aspires into becoming a user
friendly tool, usable by "the masses". And don't worry, following some simple
usability rules won't make git less "cool".

Now, that was just a suggestion,

  -- aghiles

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

* Re: git pull with "no common commits" : danger?
  2010-04-08  1:56 git pull with "no common commits" : danger? Aghiles
  2010-04-08  2:08 ` Michael J Gruber
@ 2010-04-08  5:44 ` Jonathan Nieder
  2010-04-08 19:55   ` Aghiles
  2010-04-08  6:20 ` Junio C Hamano
  2 siblings, 1 reply; 7+ messages in thread
From: Jonathan Nieder @ 2010-04-08  5:44 UTC (permalink / raw)
  To: Aghiles; +Cc: git list, Michael J Gruber

Hi,

Aghiles wrote:

> I mistakenly pulled a project into another project. I had the
> "warning: no common commits" but the pull did proceed.

First: you are aware that interrupting the pull will have no bad
side-effects, right?  So if the worry is lost time, then git is not
advertising its features well enough.

Because of this, if ‘git fetch’ starts refusing to fetch when there
are no common commits, I will be unhappy, because it imposes hassle on
the user for basically no benefit.

On the other hand, ‘git pull’ is a little different.  The fetch has
very little cost because it’s interruptible, but the merge could
result in two unrelated pieces of history being merged, requiring
the user to use ‘git reset --keep HEAD^’ to get back to the
previous state.  A more likely outcome is a merge conflict, requiring
‘git reset --merge’ to recover.

Can we make this less painful?  Is it worth adding yet another option
to ‘git pull’ to avoid this pain?  I don’t know.

Regards,
Jonathan

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

* Re: git pull with "no common commits" : danger?
  2010-04-08  1:56 git pull with "no common commits" : danger? Aghiles
  2010-04-08  2:08 ` Michael J Gruber
  2010-04-08  5:44 ` Jonathan Nieder
@ 2010-04-08  6:20 ` Junio C Hamano
  2010-04-08 19:46   ` Aghiles
  2 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2010-04-08  6:20 UTC (permalink / raw)
  To: Aghiles; +Cc: git list

Aghiles <aghilesk@gmail.com> writes:

> I mistakenly pulled a project into another project. I had the
> "warning: no common commits" but the pull did proceed.
> I am wondering if, from a usability point of view, it would be
> best to avoid doing so by default.

Refusing this without an escape hatch would regress two minor but valid
workflows.

 1. "a cross-project merge" like 5569bf9 (Do a cross-project merge of Paul
    Mackerras' gitk visualizer, 2005-06-22) aka "The coolest merge ever".
    Being able to do this kind of merge after the fact is the whole point
    of allowing merges between two histories with no common commits.

 2. A not so uncommon newbie mistake sequence:

    $ git init
    $ git pull $there

    instead of the usual

    $ git clone $there
    
    which was an actual complaint that led to the "merge into emptiness"
    behaviour of "git pull" in such a case added as a new feature.

If we were to forbid a "nothing in common" merge by default and add an
option to explicitly allow it on demand, I would not be worried too much
about the first use case.  Anybody who runs a cross-project merge has
already learned git well enough that having to add an extra option is not
a problem.

But I would be unhappy if I have to be the one to hear complaints from
newbies who are now forced to add an obscure option to his "git pull" in
the second case.

So this is not so cut-and-dried from the usability point of view as you
seem to think.

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

* Re: git pull with "no common commits" : danger?
  2010-04-08  6:20 ` Junio C Hamano
@ 2010-04-08 19:46   ` Aghiles
  0 siblings, 0 replies; 7+ messages in thread
From: Aghiles @ 2010-04-08 19:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git list

Junio C Hamano <gitster@pobox.com> writes:

>
> ...
>
> But I would be unhappy if I have to be the one to hear complaints from
> newbies who are now forced to add an obscure option to his "git pull" in
> the second case.
>
> So this is not so cut-and-dried from the usability point of view as you
> seem to think.

I understand your reasoning for the second case, and the init/pull sequence
is something I used to do too. Thanks for the explanations.

Regarding this init/pull sequence: it might be nice to print something like:

  Merging with an empty tree,  'git clone' intended ?

I see more and more such messages when using various git commands, it
helps a lot.

  -- aghiles

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

* Re: git pull with "no common commits" : danger?
  2010-04-08  5:44 ` Jonathan Nieder
@ 2010-04-08 19:55   ` Aghiles
  0 siblings, 0 replies; 7+ messages in thread
From: Aghiles @ 2010-04-08 19:55 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git list, Michael J Gruber

Jonathan Nieder <jrnieder@gmail.com> writes:
>
> ...
>
> On the other hand, ‘git pull’ is a little different.  The fetch has
> very little cost because it’s interruptible, but the merge could
> result in two unrelated pieces of history being merged, requiring
> the user to use ‘git reset --keep HEAD^’ to get back to the
> previous state.  A more likely outcome is a merge conflict, requiring
> ‘git reset --merge’ to recover.
>
> Can we make this less painful?  Is it worth adding yet another option
> to ‘git pull’ to avoid this pain?  I don’t know.

That is exactly the case I was talking about.  I never lost any data
because of this and considering what Junio Hamano is saying I
probably should just continue to do the 'git reset'.

  -- aghiles

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

end of thread, other threads:[~2010-04-08 19:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08  1:56 git pull with "no common commits" : danger? Aghiles
2010-04-08  2:08 ` Michael J Gruber
2010-04-08  2:43   ` Aghiles
2010-04-08  5:44 ` Jonathan Nieder
2010-04-08 19:55   ` Aghiles
2010-04-08  6:20 ` Junio C Hamano
2010-04-08 19:46   ` Aghiles

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.