{"thread":{"id":"3914","subject":"Clone with local alternates?","startedAt":"2006-04-18T23:48:51Z","lastAt":"2006-04-19T09:42:34Z","messageCount":7,"participants":["David Woodhouse","Shawn Pearce","Eric W. Biederman"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"18835","messageId":"1145404132.16166.97.camel@shinybook.infradead.org","threadId":"3914","inReplyTo":null,"subject":"Clone with local alternates?","fromName":"David Woodhouse","fromEmail":"dwmw2@infradead.org","sentAt":"2006-04-18T23:48:51Z","receivedAt":"2006-04-18T23:48:51Z","isPatch":false,"sender":{"key":"dwmw2@infradead.org","avatar":"https://gravatar.com/avatar/7afd4f07e0cf7d7e046ae2d23678296b37777c96488e6f3451e78a5514154ebd?d=mp&s=160"},"body":"Often I want to clone a remote repository but would like to use an\nexisting local source tree as 'alternates'. \n\nOne way of doing this is to clone the local tree with 'git-clone -l -s',\nfind the latest common commit shared with the remote tree to be fetched,\nrevert to that with 'git-reset --head $last' and then pulling from the\nremote. \n\nIs that _really_ the best way of doing it though? It would be better if\nwe just had a '--local-alternates=/foo' option to git-clone when cloning\na remote repository.\n\n-- \ndwmw2\n"},{"id":"18836","messageId":"20060418235658.GB8915@spearce.org","threadId":"3914","inReplyTo":"1145404132.16166.97.camel@shinybook.infradead.org","subject":"Re: Clone with local alternates?","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-04-18T23:56:58Z","receivedAt":"2006-04-18T23:56:58Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"David Woodhouse <dwmw2@infradead.org> wrote:\n> Often I want to clone a remote repository but would like to use an\n> existing local source tree as 'alternates'. \n> \n> One way of doing this is to clone the local tree with 'git-clone -l -s',\n> find the latest common commit shared with the remote tree to be fetched,\n> revert to that with 'git-reset --head $last' and then pulling from the\n> remote. \n> \n> Is that _really_ the best way of doing it though? It would be better if\n> we just had a '--local-alternates=/foo' option to git-clone when cloning\n> a remote repository.\n\n  git clone --reference=/foo git://remote/foo\n\nwould do the trick.  This is new in 1.3.0.  I just noticed its also\nnot documented in 1.3.0.  :-)\n\n-- \nShawn.\n"},{"id":"18837","messageId":"1145404784.16166.98.camel@shinybook.infradead.org","threadId":"3914","inReplyTo":"20060418235658.GB8915@spearce.org","subject":"Re: Clone with local alternates?","fromName":"David Woodhouse","fromEmail":"dwmw2@infradead.org","sentAt":"2006-04-18T23:59:43Z","receivedAt":"2006-04-18T23:59:43Z","isPatch":false,"sender":{"key":"dwmw2@infradead.org","avatar":"https://gravatar.com/avatar/7afd4f07e0cf7d7e046ae2d23678296b37777c96488e6f3451e78a5514154ebd?d=mp&s=160"},"body":"On Tue, 2006-04-18 at 19:56 -0400, Shawn Pearce wrote:\n>   git clone --reference=/foo git://remote/foo\n> \n> would do the trick.  This is new in 1.3.0.  I just noticed its also\n> not documented in 1.3.0.  :-)\n\nAha. Thanks.\n\n-- \ndwmw2\n"},{"id":"18840","messageId":"20060419001948.GC8915@spearce.org","threadId":"3914","inReplyTo":"20060418235658.GB8915@spearce.org","subject":"[PATCH] Document git-clone --reference","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-04-19T00:19:48Z","receivedAt":"2006-04-19T00:19:48Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"The new --reference flag introduced to git-clone in\nGIT 1.3.0 was not documented but is rather handy.\nSo document it.\n\nAlso corrected a minor issue with the documentation for the\n-s flag; the info/alternates file name was spelled wrong.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n\n---\n\n  Shawn Pearce <spearce@spearce.org> wrote:\n  >   git clone --reference=/foo git://remote/foo\n  > \n  > would do the trick.  This is new in 1.3.0.  I just noticed its also\n  > not documented in 1.3.0.  :-)\n\n Documentation/git-clone.txt |   21 ++++++++++++++++++++-\n 1 files changed, 20 insertions(+), 1 deletions(-)\n\nbase 6625864c8ce9868ba4ab41165d97084f3f04bbed\nlast 66a5bd88d2a8d9d64d86733852fbaba9caa756b0\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex 9ac54c2..131e445 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -10,6 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git-clone' [-l [-s]] [-q] [-n] [--bare] [-o <name>] [-u <upload-pack>]\n+\t  [--reference <repository>]\n \t  <repository> [<directory>]\n \n DESCRIPTION\n@@ -46,10 +47,18 @@ OPTIONS\n -s::\n \tWhen the repository to clone is on the local machine,\n \tinstead of using hard links, automatically setup\n-\t.git/objects/info/alternatives to share the objects\n+\t.git/objects/info/alternates to share the objects\n \twith the source repository.  The resulting repository\n \tstarts out without any object of its own.\n \n+--reference <repository>::\n+\tIf the reference repository is on the local machine\n+\tautomatically setup .git/objects/info/alternates to\n+\tobtain objects from the reference repository.  Using\n+\tan already existing repository as an alternate will\n+\trequire less objects to be copied from the repository\n+\tbeing cloned, reducing network and local storage costs.\n+\n --quiet::\n -q::\n \tOperate quietly.  This flag is passed to \"rsync\" and\n@@ -112,6 +121,16 @@ Make a local clone that borrows from the\n ------------\n \n \n+Clone from upstream while borrowing from an existing local directory::\n++\n+------------\n+$ git clone --reference my2.6 \\\n+\tgit://git.kernel.org/pub/scm/.../linux-2.7 \\\n+\tmy2.7\n+$ cd my2.7\n+------------\n+\n+\n Create a bare repository to publish your changes to the public::\n +\n ------------\n-- \n1.3.0.rc4.g8060\n"},{"id":"18863","messageId":"1145435957.13200.39.camel@pmac.infradead.org","threadId":"3914","inReplyTo":"20060418235658.GB8915@spearce.org","subject":"Re: Clone with local alternates?","fromName":"David Woodhouse","fromEmail":"dwmw2@infradead.org","sentAt":"2006-04-19T08:39:17Z","receivedAt":"2006-04-19T08:39:17Z","isPatch":false,"sender":{"key":"dwmw2@infradead.org","avatar":"https://gravatar.com/avatar/7afd4f07e0cf7d7e046ae2d23678296b37777c96488e6f3451e78a5514154ebd?d=mp&s=160"},"body":"On Tue, 2006-04-18 at 19:56 -0400, Shawn Pearce wrote:\n>   git clone --reference=/foo git://remote/foo\n\nThat's nice. What would be even _nicer_ is if I could enforce its usage\non the server. I keep a clean copy of Linus' kernel tree on the machine\nwith the git dæmon, so I'd like to make it refuse to send any objects\nwhich are in that tree and which people should already have fetched from\nelsewhere anyway.\n\n-- \ndwmw2\n"},{"id":"18864","messageId":"m1vet5oqk9.fsf@ebiederm.dsl.xmission.com","threadId":"3914","inReplyTo":"1145404132.16166.97.camel@shinybook.infradead.org","subject":"Re: Clone with local alternates?","fromName":"Eric W. Biederman","fromEmail":"ebiederm@xmission.com","sentAt":"2006-04-19T09:36:06Z","receivedAt":"2006-04-19T09:36:06Z","isPatch":false,"sender":{"key":"ebiederm@xmission.com","avatar":"https://avatars.githubusercontent.com/u/7477136?v=4"},"body":"David Woodhouse <dwmw2@infradead.org> writes:\n\n> Often I want to clone a remote repository but would like to use an\n> existing local source tree as 'alternates'. \n>\n> One way of doing this is to clone the local tree with 'git-clone -l -s',\n> find the latest common commit shared with the remote tree to be fetched,\n> revert to that with 'git-reset --head $last' and then pulling from the\n> remote. \n\nSimpler than the git-reset you can simply do \ngit-fetch remote branch:branch and git will find common ancestor\nfor you and create a new branch that mirrors the old one.\n\nI mention this because it can be interesting to have branches\nfrom several remote repositories all in one local repository.\n\nEric\n"},{"id":"18865","messageId":"m1r73toq9h.fsf@ebiederm.dsl.xmission.com","threadId":"3914","inReplyTo":"1145435957.13200.39.camel@pmac.infradead.org","subject":"Re: Clone with local alternates?","fromName":"Eric W. Biederman","fromEmail":"ebiederm@xmission.com","sentAt":"2006-04-19T09:42:34Z","receivedAt":"2006-04-19T09:42:34Z","isPatch":false,"sender":{"key":"ebiederm@xmission.com","avatar":"https://avatars.githubusercontent.com/u/7477136?v=4"},"body":"David Woodhouse <dwmw2@infradead.org> writes:\n\n> On Tue, 2006-04-18 at 19:56 -0400, Shawn Pearce wrote:\n>>   git clone --reference=/foo git://remote/foo\n>\n> That's nice. What would be even _nicer_ is if I could enforce its usage\n> on the server. I keep a clean copy of Linus' kernel tree on the machine\n> with the git dæmon, so I'd like to make it refuse to send any objects\n> which are in that tree and which people should already have fetched from\n> elsewhere anyway.\n\nGiven how large the linux kernel archive is I can see the desire.\n\nAt git startup there is an exchange of common commits. to\nfind the best place to build the pack from so what you want\nis possible.  I haven't a clue how you would describe it\nthough in the face of multiple branches, coming off the\ntrunk at different times.\n\nEric\n"}]}