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

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

From
MKMike Kasprzak <mike@sykhronics.com>
Date
Jul 24, 2015, 18:04 UTC
Message-ID
<CACjsLYAPqCujmR0wQM-CD=qrPJz1zrC11Pe=C07DUBdEsG2r7A@mail.gmail.com>
Hi,

I run a project with 2 repositories. One is a vagrant based toolchain (a VM that runs a LAMP server), and the other is the source code. Because I want my users to keep and make their changes to a clone of the source repository, we can't use submodules. They make their changes, test locally, and push them at me when they're done.

The source code goes in a 'www' subdirectory, but for an improved user experience, I include a pre-configured version of the config file in that 'www' directory. That way, after they check out the code and start their local server, it just works. Easy.

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.

Today we use `the workaround`, which involves doing a git init, adding a remote origin, fetching, and finally checking it out.

http://stackoverflow.com/a/18999726

This is `fine`, but it's not a good user experience. All we really want is a clone, and there just happens to be a configuration file pre-installed in the same directory.

Can we please get a flag (say -f or --force) for git clone that overrides the default behavior of not allowing you to clone in to a non-empty directory. If there already was a .git directory in that directory, sure that's a no-go scenario. An with a name like --force, it should be aggressive, overwriting anything it sees. Again, git can already do this, it's just a lot more long winded that it should be.

Thanks,
Mike Kasprzak
Next: Junio C Hamano
Message 1 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.