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

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

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 8, 2010, 05:44 UTC
Message-ID
<20100408054349.GA6067@progeny.tock>
In-Reply-To
<v2t3abd05a91004071856s5811e086q17241996a359e172@mail.gmail.com>
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

Previous: AghilesNext: Aghiles
Message 4 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.