{"thread":{"id":"42620","subject":"Easiest way to clone over an existing directory?","startedAt":"2016-06-16T06:55:53Z","lastAt":"2016-06-16T06:55:53Z","messageCount":2,"participants":["Josh Triplett","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"289300","messageId":"20160615155133.GA13168@x","threadId":"42620","inReplyTo":null,"subject":"Easiest way to clone over an existing directory?","fromName":"Josh Triplett","fromEmail":"josh@joshtriplett.org","sentAt":"2016-06-15T15:51:34Z","receivedAt":"2016-06-16T06:55:53Z","isPatch":false,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"Currently, every time I set up a new system, I run the following:\n\ngit clone $MY_HOMEDIR\nmv home/.git .\nrm -r home\ngit checkout -f\n\nThis seems like an odd dance to go through.  But I can't just git clone\ninto ~ directly, because git clone will not clone into an existing\nnon-empty directory.\n\n(I could use \"git clone -n\" to avoid the unnecessary checkout, but the\nfiles are small, and it wouldn't remove the need to rmdir so the number\nof commands would remain the same.)\n\nDoes some better way exist to handle this?  And if not, would it make\nsense for git clone to have an option to clone into an existing\ndirectory (which should also avoid setting junk_work_tree)?\n"},{"id":"289327","messageId":"20160616024434.GB371617@vauxhall.crustytoothpaste.net","threadId":"42620","inReplyTo":"20160615155133.GA13168@x","subject":"Re: Easiest way to clone over an existing directory?","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2016-06-16T02:44:34Z","receivedAt":"2016-06-16T06:55:53Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Wed, Jun 15, 2016 at 08:51:34AM -0700, Josh Triplett wrote:\n> Currently, every time I set up a new system, I run the following:\n> \n> git clone $MY_HOMEDIR\n> mv home/.git .\n> rm -r home\n> git checkout -f\n> \n> This seems like an odd dance to go through.  But I can't just git clone\n> into ~ directly, because git clone will not clone into an existing\n> non-empty directory.\n> \n> (I could use \"git clone -n\" to avoid the unnecessary checkout, but the\n> files are small, and it wouldn't remove the need to rmdir so the number\n> of commands would remain the same.)\n> \n> Does some better way exist to handle this?  And if not, would it make\n> sense for git clone to have an option to clone into an existing\n> directory (which should also avoid setting junk_work_tree)?\n\nMy typical technique is something like the following:\n\n  git init\n  git remote add origin https://git.crustytoothpaste.net/git/bmc/homedir.git\n  git pull origin master\n\nI'm not sure if that's the officially sanctioned way to do it, but it\ndoes work reliably.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"}]}