git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git pull with "no common commits" : danger?

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 8, 2010, 06:20 UTC
Message-ID
<7v1veq8nyf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<v2t3abd05a91004071856s5811e086q17241996a359e172@mail.gmail.com>
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.

Previous: AghilesNext: Aghiles
Message 6 of 7 in “git pull with "no common commits" : danger?”
  1. AghilesApr 8, 2010
  2. Michael J GruberApr 8, 2010
  3. AghilesApr 8, 2010
  4. Jonathan NiederApr 8, 2010
  5. AghilesApr 8, 2010
  6. Junio C HamanoApr 8, 2010
  7. AghilesApr 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.