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

Re: Please consider adding a -f switch to git-clone (or something similar)

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 7, 2015, 22:53 UTC
Message-ID
<20150307225314.GC742348@vauxhall.crustytoothpaste.net>
In-Reply-To
<87d24kzbor.fsf@igel.home>
On Sat, Mar 07, 2015 at 11:26:28PM +0100, Andreas Schwab wrote:
Show 5 quoted lines
>Diego Viola <diego.viola@gmail.com> writes:
>
>> I know I could git-init in a empty directory
>
>You can also git init a non-empty directory.

I have a script to set up a new throwaway VM with my dotfiles using git. It looks a bit like the following ($BRANCH != master):

  SSH="ssh $DEST"
  
  $SSH "cd; $GIT init"
  git push --receive-pack=$GIT-receive-pack $DEST:~/.git $BRANCH
  $SSH "
      $GIT pull . $BRANCH
      $GIT submodule update --init
  "

It relies on the ability to git init a non-empty directory. $BRANCH can be master if you use the new updateInstead functionality in git 2.3.0, and you can use git pull from a remote location instead of the push/pull pair if that suits you better.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Previous: Andreas SchwabNext: Diego Viola
Message 3 of 7 in “Please consider adding a -f switch to git-clone (or something similar)”
  1. Diego ViolaMar 7, 2015
  2. Andreas SchwabMar 7, 2015
  3. brian m. carlsonMar 7, 2015
  4. Diego ViolaMar 8, 2015
  5. Diego ViolaMar 8, 2015
  6. Kyle J. McKayMar 8, 2015
  7. Diego ViolaMar 8, 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.