{"thread":{"id":"28716","subject":"shallow&single-branch clone?","startedAt":"2011-10-19T13:30:48Z","lastAt":"2011-10-21T01:22:59Z","messageCount":2,"participants":["Norbert Nemec","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"177993","messageId":"4E9ED108.5020505@native-instruments.de","threadId":"28716","inReplyTo":null,"subject":"shallow&single-branch clone?","fromName":"Norbert Nemec","fromEmail":"norbert.nemec@native-instruments.de","sentAt":"2011-10-19T13:30:48Z","receivedAt":"2011-10-19T13:30:48Z","isPatch":false,"sender":{"key":"norbert.nemec@native-instruments.de","avatar":null},"body":"Hi there,\n\nit seems like there is no way to clone a single branch with truncated \nhistory.\n\nTruncating history is done by 'git clone --depth 1', there is not way to \nrestrict 'clone' to a single branch (the --branch option still downloads \nall branches and only then chooses something other than HEAD as active \nbranch).\n\nThe manual sequence\n\tgit init\n\tgit remote add -t master -f origin URL\n\tgit checkout\nallows a clone of a single branch but offers no means to truncate history.\n\nThe least intrusive solution would be an additional option to clone, \nperhaps '--branch-only'.\n\nMore user friendly, this options should be on by default when --depth is \nset. After all: who would expect branches to be cloned when the history \nis explicitely truncated?\n\nIdeas?\n\nGreetings,\nNorbert Nemec\n"},{"id":"178110","messageId":"20111021012259.GA13421@sigill.intra.peff.net","threadId":"28716","inReplyTo":"4E9ED108.5020505@native-instruments.de","subject":"Re: shallow&single-branch clone?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-10-21T01:22:59Z","receivedAt":"2011-10-21T01:22:59Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 19, 2011 at 03:30:48PM +0200, Norbert Nemec wrote:\n\n> Truncating history is done by 'git clone --depth 1', there is not way\n> to restrict 'clone' to a single branch (the --branch option still\n> downloads all branches and only then chooses something other than\n> HEAD as active branch).\n> \n> The manual sequence\n> \tgit init\n> \tgit remote add -t master -f origin URL\n> \tgit checkout\n> allows a clone of a single branch but offers no means to truncate history.\n\nYou can do:\n\n  git init\n  git remote add -t master origin URL\n  git fetch --depth=1\n  git checkout\n\nBut obviously that's not as nice as an option to clone.\n\n> The least intrusive solution would be an additional option to clone,\n> perhaps '--branch-only'.\n\nAgreed, that would be better. We might want to make it more flexible,\nlike:\n\n  git clone --fetch=branch1 --fetch=branch2\n\nand then by default choose \"-b branch1\" since it was mentioned first.\n\n> More user friendly, this options should be on by default when --depth\n> is set. After all: who would expect branches to be cloned when the\n> history is explicitely truncated?\n\nYeah, that probably makes sense. If the branches are related, it's\nprobably not saving much, but if you have unrelated branches, it would\nbe a nice convenience. OTOH, how would you tell git \"no, I really do\nwant the tip of every branch\"?\n\n-Peff\n"}]}