{"thread":{"id":"6585","subject":"Why is git clone not checking out files?","startedAt":"2007-01-30T18:05:38Z","lastAt":"2007-01-31T09:56:53Z","messageCount":22,"participants":["Bill Lear","Jakub Narebski","Shawn O. Pearce","Linus Torvalds","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"33056","messageId":"17855.35058.967318.546726@lisa.zopyra.com","threadId":"6585","inReplyTo":null,"subject":"Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T18:05:38Z","receivedAt":"2007-01-30T18:05:38Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"I don't understand why clone (version 1.4.4.1) is not checking out my\nfiles:\n\n% ls /repos/git/project\nbranches  description  HEAD   info     refs\nconfig    FETCH_HEAD   hooks  objects  remotes\n% git clone /repos/git/project\nremote: Generating pack...\nremote: Done counting 1149 objects.\nremote: Deltifying 1149 objects.\nremote: 149/1149) done49) done\nIndexing 1149 objects.\nremote: Total 1149, written 1149 (delta 619), reused 1149 (delta 619)\n 100% (1149/1149) done\nResolving 619 deltas.\n 100% (619/619) done\n% ls project\n% ls -a project\n.  ..  .git\n\n\nBill\n"},{"id":"33061","messageId":"epo1tn$9sl$1@sea.gmane.org","threadId":"6585","inReplyTo":"17855.35058.967318.546726@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-30T18:15:33Z","receivedAt":"2007-01-30T18:15:33Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Bill Lear wrote:\n\n> I don't understand why clone (version 1.4.4.1) is not checking out my\n> files:\n\nUnless you use git clone --bare, it should checkout HEAD branch...\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"33062","messageId":"17855.35845.922009.364704@lisa.zopyra.com","threadId":"6585","inReplyTo":"epo1tn$9sl$1@sea.gmane.org","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T18:18:45Z","receivedAt":"2007-01-30T18:18:45Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 19:15:33 (+0100) Jakub Narebski writes:\n>Bill Lear wrote:\n>\n>> I don't understand why clone (version 1.4.4.1) is not checking out my\n>> files:\n>\n>Unless you use git clone --bare, it should checkout HEAD branch...\n\nOk, well, I certainly did not issue git clone --bare, it was just a\nplain ol' clone:\n\n% git clone /repos/git/project\n\nand no checkout ensued.  Can I fix this somehow?  I've tried the clone\nseveral times with no success.  Is there anything I can check in the\nsource repo (the above /repos/git/project) to see why it would not be\nworking?\n\n\nBill\n"},{"id":"33063","messageId":"20070130182237.GC26415@spearce.org","threadId":"6585","inReplyTo":"17855.35845.922009.364704@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-01-30T18:22:37Z","receivedAt":"2007-01-30T18:22:37Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> Ok, well, I certainly did not issue git clone --bare, it was just a\n> plain ol' clone:\n> \n> % git clone /repos/git/project\n> \n> and no checkout ensued.  Can I fix this somehow?  I've tried the clone\n> several times with no success.  Is there anything I can check in the\n> source repo (the above /repos/git/project) to see why it would not be\n> working?\n\nI've seen this happen if HEAD in the source repository does not point\nat a branch, or points at a commit which doesn't exist.  Though I\nusually also see an error about how HEAD isn't a valid object name...\n\n-- \nShawn.\n"},{"id":"33064","messageId":"17855.36470.309129.391271@lisa.zopyra.com","threadId":"6585","inReplyTo":"20070130182237.GC26415@spearce.org","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T18:29:10Z","receivedAt":"2007-01-30T18:29:10Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 13:22:37 (-0500) Shawn O. Pearce writes:\n>Bill Lear <rael@zopyra.com> wrote:\n>> Ok, well, I certainly did not issue git clone --bare, it was just a\n>> plain ol' clone:\n>> \n>> % git clone /repos/git/project\n>> \n>> and no checkout ensued.  Can I fix this somehow?  I've tried the clone\n>> several times with no success.  Is there anything I can check in the\n>> source repo (the above /repos/git/project) to see why it would not be\n>> working?\n>\n>I've seen this happen if HEAD in the source repository does not point\n>at a branch, or points at a commit which doesn't exist.  Though I\n>usually also see an error about how HEAD isn't a valid object name...\n\nHmm.\n\n% cd /repos/git/project\n% ls\nbranches  description  HEAD   info     refs\nconfig    FETCH_HEAD   hooks  objects  remotes\n% cat HEAD\nref: refs/heads/master\n% cat FETCH_HEAD\n2ed7b6f672963bab4bad713a71967f683fe01163                branch 'topic' of git://source/public/project\n2ed7b6f672963bab4bad713a71967f683fe01163        not-for-merge   tag 'fbdev_ref_1' of git://source/public/project\n\nThis repository was created like this:\n\n% mkdir /repos/git/project\n% cd /repos/git/project\n% git --bare init-db --shared\n% GIT_DIR=. git fetch git://xiphi/public/project topic:topic\n\n\nBill\n"},{"id":"33065","messageId":"Pine.LNX.4.64.0701301040200.3611@woody.linux-foundation.org","threadId":"6585","inReplyTo":"17855.36470.309129.391271@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-01-30T18:41:03Z","receivedAt":"2007-01-30T18:41:03Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 30 Jan 2007, Bill Lear wrote:\n> \n> % cd /repos/git/project\n> % ls\n> branches  description  HEAD   info     refs\n> config    FETCH_HEAD   hooks  objects  remotes\n> % cat HEAD\n> ref: refs/heads/master\n\nOk, HEAD points to \"master\".\n\n> This repository was created like this:\n> \n> % mkdir /repos/git/project\n> % cd /repos/git/project\n> % git --bare init-db --shared\n> % GIT_DIR=. git fetch git://xiphi/public/project topic:topic\n\n...but you don't _have_ any such branch. You only have a \"topic\" branch.\n\n\t\tLinus\n"},{"id":"33066","messageId":"200701301950.00195.jnareb@gmail.com","threadId":"6585","inReplyTo":"Pine.LNX.4.64.0701301040200.3611@woody.linux-foundation.org","subject":"Re: Why is git clone not checking out files?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-30T18:49:59Z","receivedAt":"2007-01-30T18:49:59Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote:\n> On Tue, 30 Jan 2007, Bill Lear wrote:\n>> \n>> % cd /repos/git/project\n>> % ls\n>> branches  description  HEAD   info     refs\n>> config    FETCH_HEAD   hooks  objects  remotes\n>> % cat HEAD\n>> ref: refs/heads/master\n> \n> Ok, HEAD points to \"master\".\n> \n>> This repository was created like this:\n>> \n>> % mkdir /repos/git/project\n>> % cd /repos/git/project\n>> % git --bare init-db --shared\n>> % GIT_DIR=. git fetch git://xiphi/public/project topic:topic\n> \n> ...but you don't _have_ any such branch. You only have a \"topic\"\n> branch. \n\n...so \"git clone\" tries to checkout HEAD -> refs/heads/master\nbranch, which does not exist. It is strange that git does not\nreport error or at least warning, though...\n\n-- \nJakub Narebski\nPoland\n"},{"id":"33067","messageId":"17855.38543.761930.929267@lisa.zopyra.com","threadId":"6585","inReplyTo":"Pine.LNX.4.64.0701301040200.3611@woody.linux-foundation.org","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T19:03:43Z","receivedAt":"2007-01-30T19:03:43Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 10:41:03 (-0800) Linus Torvalds writes:\n>On Tue, 30 Jan 2007, Bill Lear wrote:\n>...\n>> This repository was created like this:\n>> \n>> % mkdir /repos/git/project\n>> % cd /repos/git/project\n>> % git --bare init-db --shared\n>>[% GIT_DIR=. git fetch git://source/public/project topic:topic]\n>\n>...but you don't _have_ any such branch. You only have a \"topic\" branch.\n\nHmm, so I did this:\n\n% cd /repos/git/project\n% GIT_DIR=. git branch\n  topic\n\nAnd then, tried it all again:\n\n% cd ..\n% rm -rf project\n% mkdir project\n% cd project\n% git --bare clone --shared\n% GIT_DIR=. git fetch git://source/public/project\nwarning: no common commits\nremote: Generating pack...\nremote: Done counting 1148 objects.\nremote: Deltifying 1148 objects.\nremote:  100% (1148/1148) done\nUnpacking 1148 objects\nremote: Total 1148, written 1148 (delta 632), reused 1020 (delta 534)\n 100% (1148/1148) done\n% GIT_DIR=. git branch\n[eh?  No branches??]\n% cat HEAD\nref: refs/heads/master\n\nSo, where are my branches?  And don't tell me I don't need no\nsteenking branches...\n\n\nBill\n"},{"id":"33068","messageId":"Pine.LNX.4.64.0701301058250.3611@woody.linux-foundation.org","threadId":"6585","inReplyTo":"200701301950.00195.jnareb@gmail.com","subject":"Re: Why is git clone not checking out files?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-01-30T19:04:57Z","receivedAt":"2007-01-30T19:04:57Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 30 Jan 2007, Jakub Narebski wrote:\n> \n> ...so \"git clone\" tries to checkout HEAD -> refs/heads/master\n> branch, which does not exist. It is strange that git does not\n> report error or at least warning, though...\n\nWell, HEAD pointing to a non-existent branch is actually a perfectly valid \nthing. It literally means \"I haven't done the first commit yet\".\n\nSo Bill's repository is a perfectly fine repository. It has a topic branch \n(called 'topic'), and it has an empty 'master' branch that just hasn't \nseen any commits yet. You can work on it as a full and normal git \nrepository, because it really *is* a full and normal git repository.\n\nOf course, I do agree that it'sa fairly confusing way to set up a repo, \nand you generally shouldn't do it, but Bill did it that way explicitly. \nMaybe he didn't do it \"on purpose\", but git at no point in time had any \nway to know that Bill wanted somethign else. Nothing he did was \"wrong\", \nand it's quite possible that it's what he could have meant to do.\n\nAnyway, it's certainly easy to fix. Bill, you can either:\n\n - just rename the \"topic\" branch to \"master\"\n\n - change the HEAD to point to \"topic\" rather than \"master\".\n\n(and if you do that setup in the future, the way to populate the initial \nbare repository would have been to just do\n\n\tgit fetch original topic:master\n\nand you'd never have seen this, because the branch you fetched would have \nbeen named the default 'master' in the first place).\n\n\t\tLinus\n"},{"id":"33069","messageId":"20070130190907.GE26415@spearce.org","threadId":"6585","inReplyTo":"17855.38543.761930.929267@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-01-30T19:09:07Z","receivedAt":"2007-01-30T19:09:07Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> % cd /repos/git/project\n> % GIT_DIR=. git branch\n>   topic\n> \n> And then, tried it all again:\n> \n> % cd ..\n> % rm -rf project\n> % mkdir project\n> % cd project\n> % git --bare clone --shared\n> % GIT_DIR=. git fetch git://source/public/project\n\nYou did not ask for a tracking branch to be created.  So the\nresult of your fetch is in FETCH_HEAD only.  Try instead:\n\nGIT_DIR=. git fetch git://source/public/project topic:refs/heads/master\n\n-- \nShawn.\n"},{"id":"33070","messageId":"17855.39008.920685.62837@lisa.zopyra.com","threadId":"6585","inReplyTo":"Pine.LNX.4.64.0701301058250.3611@woody.linux-foundation.org","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T19:11:28Z","receivedAt":"2007-01-30T19:11:28Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 11:04:57 (-0800) Linus Torvalds writes:\n>...\n>Of course, I do agree that it'sa fairly confusing way to set up a repo, \n>and you generally shouldn't do it, but Bill did it that way explicitly. \n>Maybe he didn't do it \"on purpose\", but git at no point in time had any \n>way to know that Bill wanted somethign else. Nothing he did was \"wrong\", \n>and it's quite possible that it's what he could have meant to do.\n\nMy setup was prompted by advice I got here.  Perhaps I misunderstood.\nI thought the way to set up a shared public repo for my collaborators\nwas to git --bare init-db --shared, then do a git fetch from the upstream\nrepo.  I want to be able to push into my public repo from one or more\nof my private repos, hence the need (I was told) for he bare option.\n\n>Anyway, it's certainly easy to fix. Bill, you can either:\n>\n> - just rename the \"topic\" branch to \"master\"\n\nI don't think I want this.  I want to know I'm on the topic branch of\nthat repo, anything else really makes me nervous.\n\n> - change the HEAD to point to \"topic\" rather than \"master\".\n\nSame for this...[Thanks for the advice, nevertheless.]\n\nI wonder if the original repo I pulled from is just messed up.  Ahh --\nI see Shawn just replied saying I needed to fetch in a different way.\nI shall peruse that and report clarity of vision when achieved...\n\n\nBill\n"},{"id":"33071","messageId":"Pine.LNX.4.63.0701302013420.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6585","inReplyTo":"17855.39008.920685.62837@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-30T19:15:37Z","receivedAt":"2007-01-30T19:15:37Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 30 Jan 2007, Bill Lear wrote:\n\n> On Tuesday, January 30, 2007 at 11:04:57 (-0800) Linus Torvalds writes:\n> \n> >Anyway, it's certainly easy to fix. Bill, you can either:\n> >\n> > - just rename the \"topic\" branch to \"master\"\n> \n> I don't think I want this.  I want to know I'm on the topic branch of \n> that repo, anything else really makes me nervous.\n\nThe name in the bare repository does not matter as much as your _local_ \nname.\n\n> > - change the HEAD to point to \"topic\" rather than \"master\".\n> \n> Same for this...[Thanks for the advice, nevertheless.]\n\nIf you have only _one_ branch in the upstream repo, why don't you let \n\"HEAD\" (in that repo) point to that branch, but to a non-existent \n\"master\"? That does not make sense.\n\nCiao,\nDscho\n"},{"id":"33072","messageId":"200701302017.15364.jnareb@gmail.com","threadId":"6585","inReplyTo":"20070130190907.GE26415@spearce.org","subject":"Re: Why is git clone not checking out files?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-30T19:17:14Z","receivedAt":"2007-01-30T19:17:14Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Shawn O. Pearce wrote:\n> Bill Lear <rael@zopyra.com> wrote:\n\n>> % git --bare clone --shared\n>> % GIT_DIR=. git fetch git://source/public/project\n> \n> You did not ask for a tracking branch to be created.  So the\n> result of your fetch is in FETCH_HEAD only.  Try instead:\n> \n> GIT_DIR=. git fetch git://source/public/project topic:refs/heads/master\n\nOr you can use \"git clone --bare --shared\" (not \"git --bare clone\";\nthere is a diference).\n\n-- \nJakub Narebski\nPoland\n"},{"id":"33073","messageId":"200701302018.43119.jnareb@gmail.com","threadId":"6585","inReplyTo":"Pine.LNX.4.64.0701301058250.3611@woody.linux-foundation.org","subject":"Re: Why is git clone not checking out files?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-30T19:18:42Z","receivedAt":"2007-01-30T19:18:42Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote:\n\n> Anyway, it's certainly easy to fix. Bill, you can either:\n> \n>  - just rename the \"topic\" branch to \"master\"\n> \n>  - change the HEAD to point to \"topic\" rather than \"master\".\n\nOr, in repository you clone from, do \"git pull . topic\" when\non master, and you will have 'master' branch for your own work,\nwhich would be fast-forward of 'topic'.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"33075","messageId":"17855.39959.848058.957592@lisa.zopyra.com","threadId":"6585","inReplyTo":"20070130190907.GE26415@spearce.org","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T19:27:19Z","receivedAt":"2007-01-30T19:27:19Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 14:09:07 (-0500) Shawn O. Pearce writes:\n>...\n>You did not ask for a tracking branch to be created.  So the\n>result of your fetch is in FETCH_HEAD only.  Try instead:\n>\n>GIT_DIR=. git fetch git://source/public/project topic:refs/heads/master\n\nOk, then when I clone this my master branch in my cloned repo will\nactually be pointing to the topic branch of the remote repo?\n\n[recreate dir, re-init, fetch as above, clone; now, cd into cloned repo]\n% cd project\n% git branch\n* master\n  origin\n\nThis makes me really nervous, like a nervousness-inducing cloaking\ndevice would.  I'm not enough of a git master to just \"use the force\".\nWhen I go into my cloned repo, I want to see \"topic\" for my branch\nname, not master...\n\nBTW, I note also that the clone seems to have taken GOBS more time\nthis time around.  Am I seeing things or would this be a result of the\nfetch gymnastics above?\n\n\nBill\n"},{"id":"33076","messageId":"Pine.LNX.4.64.0701301123300.3611@woody.linux-foundation.org","threadId":"6585","inReplyTo":"17855.38543.761930.929267@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-01-30T19:33:58Z","receivedAt":"2007-01-30T19:33:58Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 30 Jan 2007, Bill Lear wrote:\n>\n> Hmm, so I did this:\n> \n> % cd /repos/git/project\n> % GIT_DIR=. git branch\n>   topic\n> \n> And then, tried it all again:\n> \n> % cd ..\n> % rm -rf project\n> % mkdir project\n> % cd project\n> % git --bare clone --shared\n> % GIT_DIR=. git fetch git://source/public/project\n\nHeh. That's not doing what you seem to expect.\n\nIf you don't give it a branch to fetch into, \"git fetch\" will not populate \n*any* branch. It does fetch the data:\n\n> warning: no common commits\n> remote: Generating pack...\n> remote: Done counting 1148 objects.\n> remote: Deltifying 1148 objects.\n> remote:  100% (1148/1148) done\n> Unpacking 1148 objects\n> remote: Total 1148, written 1148 (delta 632), reused 1020 (delta 534)\n>  100% (1148/1148) done\n\nbut it never wrote it into a branch, since you didn't tell it where it \nshould go.\n\nIt didn't go away entirely, though: it's referenced by FETCH_HEAD, and \nthis is actually the *common* thing for fetch usage when you use it to \njust them merge the fetched result into your current head. That is, for \nexample, what I do all the time (except the \"fetch+merge\" thing is usually \njust called \"git pull\" ;)\n\n> % GIT_DIR=. git branch\n> [eh?  No branches??]\n\nRight.\n\n> % cat HEAD\n> ref: refs/heads/master\n\n.. and again, this is fine, but it just means that since no \"master\" \nbranch exists, you have an empty HEAD with no commits.\n\n> So, where are my branches?  And don't tell me I don't need no\n> steenking branches...\n\nYou absolutely need some steenking branches, but you need to tell git \nwhich branch you want to use.\n\nSo either use\n\n\tgit --bare fetch git://source/public/project topic:master\n\n(to tell git to fetch the remote 'topic' into the local 'master')\n\nOR, if you just prefer using the 'topic' name - which is certainly not \nwrong at all, do\n\n\tgit --bare fetch git://source/public/project topic:topic\n\tgit --bare symbolic-ref HEAD refs/heads/topic\n\nwhere that second line is important: it's the one that tells that you want \nHEAD to be pointing to the 'topic' branch.\n\n[ You could have done that second line before the fetch, and really \n  considered it part of the \"create repository\" sequence, rather than the \n  \"fetch\" sequence ]\n\nOr something like that.\n\n\t\tLinus\n"},{"id":"33077","messageId":"17855.40530.256749.539318@lisa.zopyra.com","threadId":"6585","inReplyTo":"Pine.LNX.4.63.0701302013420.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T19:36:50Z","receivedAt":"2007-01-30T19:36:50Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 20:15:37 (+0100) Johannes Schindelin writes:\n>On Tue, 30 Jan 2007, Bill Lear wrote:\n>> On Tuesday, January 30, 2007 at 11:04:57 (-0800) Linus Torvalds writes:\n>> \n>> >Anyway, it's certainly easy to fix. Bill, you can either:\n>> >\n>> > - just rename the \"topic\" branch to \"master\"\n>> \n>> I don't think I want this.  I want to know I'm on the topic branch of \n>> that repo, anything else really makes me nervous.\n>\n>The name in the bare repository does not matter as much as your _local_ \n>name.\n\nWell, being a git newbie, it kinda matters to me.  I need linearity\nright now.  Anything that swerves is likely to result in me and my\nproject stuck in the weeds.\n\nSo, I tried a straight fetch:\n\n% GIT_DIR=. git fetch git://source/public/project\n\nThis has one branch:\n\n% GIT_DIR=. git branch\n  topic\n\nThen a clone of that:\n\n% cd over_there\n% git clone /repos/git/project\n[...]\n% cd project\n% git branch\n  topic\n\nAll is well exactly what I want and expect ... except:\n\n% ls -a\n.  ..  .git\n\nNo checkout was done.  I'm finding this extremely confusing.\n\nI just want to work on the branch, and I want it identified as such,\nand I want it checked out, and I want some candy.\n\nSorry to whine, just wish I understood this better.\n\n\nBill\n"},{"id":"33079","messageId":"17855.40922.849939.976654@lisa.zopyra.com","threadId":"6585","inReplyTo":"17855.40530.256749.539318@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T19:43:22Z","receivedAt":"2007-01-30T19:43:22Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 13:36:50 (-0600) Bill Lear writes:\n>On Tuesday, January 30, 2007 at 20:15:37 (+0100) Johannes Schindelin writes:\n>>On Tue, 30 Jan 2007, Bill Lear wrote:\n>>> On Tuesday, January 30, 2007 at 11:04:57 (-0800) Linus Torvalds writes:\n>>> \n>>> >Anyway, it's certainly easy to fix. Bill, you can either:\n>>> >\n>>> > - just rename the \"topic\" branch to \"master\"\n>>> \n>>> I don't think I want this.  I want to know I'm on the topic branch of \n>>> that repo, anything else really makes me nervous.\n>>\n>>The name in the bare repository does not matter as much as your _local_ \n>>name.\n>\n>Well, being a git newbie, it kinda matters to me.  I need linearity\n>right now.  Anything that swerves is likely to result in me and my\n>project stuck in the weeds.\n>\n>So, I tried a straight fetch:\n>\n>% GIT_DIR=. git fetch git://source/public/project\n>\n>This has one branch:\n>\n>% GIT_DIR=. git branch\n>  topic\n\nUmmm, I may have made a mistake here ... doing again to ensure I did\nnot mis-type above ...\n\n\nBill\n"},{"id":"33080","messageId":"17855.41582.273304.760413@lisa.zopyra.com","threadId":"6585","inReplyTo":"17855.40922.849939.976654@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T19:54:22Z","receivedAt":"2007-01-30T19:54:22Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, January 30, 2007 at 13:43:22 (-0600) Bill Lear writes:\n>On Tuesday, January 30, 2007 at 13:36:50 (-0600) Bill Lear writes:\n>>On Tuesday, January 30, 2007 at 20:15:37 (+0100) Johannes Schindelin writes:\n>>>On Tue, 30 Jan 2007, Bill Lear wrote:\n>>>> On Tuesday, January 30, 2007 at 11:04:57 (-0800) Linus Torvalds writes:\n>>>> \n>>>> >Anyway, it's certainly easy to fix. Bill, you can either:\n>>>> >\n>>>> > - just rename the \"topic\" branch to \"master\"\n>>>> \n>>>> I don't think I want this.  I want to know I'm on the topic branch of \n>>>> that repo, anything else really makes me nervous.\n>>>\n>>>The name in the bare repository does not matter as much as your _local_ \n>>>name.\n>>\n>>Well, being a git newbie, it kinda matters to me.  I need linearity\n>>right now.  Anything that swerves is likely to result in me and my\n>>project stuck in the weeds.\n>>\n>>So, I tried a straight fetch:\n>>\n>>% GIT_DIR=. git fetch git://source/public/project\n>>\n>>This has one branch:\n>>\n>>% GIT_DIR=. git branch\n>>  topic\n>\n>Ummm, I may have made a mistake here ... doing again to ensure I did\n>not mis-type above ...\n\nOk, I hate twice quoting my self, especially to admit to crack smoking.\nI was indeed apparently smoking crack --- no such branch shows up...\n\n\nBill\n"},{"id":"33081","messageId":"Pine.LNX.4.64.0701301153580.3611@woody.linux-foundation.org","threadId":"6585","inReplyTo":"Pine.LNX.4.64.0701301123300.3611@woody.linux-foundation.org","subject":"Re: Why is git clone not checking out files?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-01-30T20:00:55Z","receivedAt":"2007-01-30T20:00:55Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 30 Jan 2007, Linus Torvalds wrote:\n> \n> So either use\n> \n> \tgit --bare fetch git://source/public/project topic:master\n> \n> (to tell git to fetch the remote 'topic' into the local 'master')\n\nSide note: it's usually a good idea to have a 'master' branch, not so much \nbecause git itself really cares (it's just a default, after all, in a \ntechnical sense), but more because NOT having a master branch may then end \nup confusing other people who try to access the repository, and it doesn't \nhave the normal default branch.\n\n> OR, if you just prefer using the 'topic' name - which is certainly not \n> wrong at all, do\n> \n> \tgit --bare fetch git://source/public/project topic:topic\n> \tgit --bare symbolic-ref HEAD refs/heads/topic\n\nAnd another note on this. I did do that with a special command, and yes, \nth is is what you should do in a script. HOWEVER, as with .git/config, I \nreally think it's probably just easier to open your editor on the HEAD \nfile directly, and just do that renaming by hand.\n\nI _like_ people being able to just open files and mucking with them. It's \nconsidered extremely bad form in CVS (yeah, people _do_ actually open the \nCVS internal *,v files and muck with them, and it's a horrible horrible \nthing to do, but sometimes people have reason to do it), but in git, all \nthe files you really *really* must not try to edit are compressed binary \nfiles and are protected by really strong checksums etc, so I don't think \nit's wrong to encourage people to edit files under .git/ by hand.\n\nThe things that can be edited are perfectly fine to edit. You can screw \nthings up, of course, but on the other hand, I think people can really get \na much better feeling for what git does if they end up understanding the \nfiles that git depends on.\n\nSo by all means, get down and dirty, and just fire up your editor on \n.git/HEAD when you want to create a repository that has some other default \nHEAD than 'master'.\n\n\t\tLinus\n"},{"id":"33084","messageId":"17855.44217.393543.893129@lisa.zopyra.com","threadId":"6585","inReplyTo":"17855.40530.256749.539318@lisa.zopyra.com","subject":"Re: Why is git clone not checking out files?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-30T20:38:17Z","receivedAt":"2007-01-30T20:38:17Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"Ok, in my own inimitable way, I think I have figured this out.  Please\nlet me know if this is dumb (output of commands below clipped):\n\n% git --bare init-db --shared\n% GIT_DIR=. git fetch git://source/public/project topic:topic\n% cd there\n% git clone /repos/git/project\n% cd project\n% git checkout topic\nwarning: You do not appear to currently be on a branch.\nwarning: Forcing checkout of topic^0.\n\nIf this is ok, this appears to give me the result I want ... I think.\n\nThanks to all for hand-holding the blind and if someone already mentioned\nthis option, apologies for missing it.\n\n\nBill\n\nOn Tuesday, January 30, 2007 at 13:36:50 (-0600) Bill Lear writes:\n>On Tuesday, January 30, 2007 at 20:15:37 (+0100) Johannes Schindelin writes:\n> ...\n"},{"id":"33118","messageId":"8fe92b430701310156u958f6dau31552c636ba6bce2@mail.gmail.com","threadId":"6585","inReplyTo":"200701301950.00195.jnareb@gmail.com","subject":"Re: Why is git clone not checking out files?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-31T09:56:53Z","receivedAt":"2007-01-31T09:56:53Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On 1/30/07, Jakub Narebski <jnareb@gmail.com> wrote:\n\n> ...so \"git clone\" tries to checkout HEAD -> refs/heads/master\n> branch, which does not exist. It is strange that git does not\n> report error or at least warning, though...\n\nIt would be nice if git-clone at the very end (at checkout) wrote which\nbranch we are at, e.g.\n  \"On branch refs/heads/master\"\n  \"Not currently on any branch\"\n  \"Current branch refs/heads/master does not exist\"\n-- \nJakub Narebski\n"}]}