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

Re: Can we get a git clone flag to override the "required empty directory" behaviour?

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 24, 2015, 21:41 UTC
Message-ID
<xmqq6159kzcn.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CACjsLYAPqCujmR0wQM-CD=qrPJz1zrC11Pe=C07DUBdEsG2r7A@mail.gmail.com>
Mike Kasprzak <mike@sykhronics.com> writes:
> What I would like to do is git clone inside that directory. Alas, git
> will not let you clone in any directory containing a file.
In the ideal world, I think both of these two commands:
    $ git clone $URL somewhere
    $ cd somewhere && git clone $URL .
should behave just like:
    - if somewhere/.git exists, barf and fail
    - otherwise, do the "git init && git add remote && git fetch"
      followed by "git checkout" dance.

without any additional option. The final "checkout" step should fail if the "untracked files" you have in the existing directory interfere with it.

It used to be that you always had to create a "new" directory, not even an empty directory was allowed. Recently we took a small step in that direction.

That hasn't happened, and will not happen unless somebody works on it. The thing is that it would not just be the matter of adding a command line flag. There are tons of things "git clone" can do differently from "git fetch" and using much simpler and performant logic because it assumes that the directory it is cloning into is an empty one.

Previous: Mike Kasprzak
Message 2 of 2 in “Can we get a git clone flag to override the "required empty directory" behaviour?”
  1. Mike KasprzakJul 24, 2015
  2. Junio C HamanoJul 24, 2015

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.