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

Re: Why is git clone not checking out files?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jan 30, 2007, 19:04 UTC
Message-ID
<Pine.LNX.4.64.0701301058250.3611@woody.linux-foundation.org>
In-Reply-To
<200701301950.00195.jnareb@gmail.com>
On Tue, 30 Jan 2007, Jakub Narebski wrote:
> 
> ...so "git clone" tries to checkout HEAD -> refs/heads/master
> branch, which does not exist. It is strange that git does not
> report error or at least warning, though...

Well, HEAD pointing to a non-existent branch is actually a perfectly valid thing. It literally means "I haven't done the first commit yet".

So Bill's repository is a perfectly fine repository. It has a topic branch (called 'topic'), and it has an empty 'master' branch that just hasn't seen any commits yet. You can work on it as a full and normal git repository, because it really *is* a full and normal git repository.

Of course, I do agree that it'sa fairly confusing way to set up a repo, and you generally shouldn't do it, but Bill did it that way explicitly. Maybe he didn't do it "on purpose", but git at no point in time had any way to know that Bill wanted somethign else. Nothing he did was "wrong", and it's quite possible that it's what he could have meant to do.

Anyway, it's certainly easy to fix. Bill, you can either:
 - just rename the "topic" branch to "master"
 - change the HEAD to point to "topic" rather than "master".

(and if you do that setup in the future, the way to populate the initial bare repository would have been to just do

	git fetch original topic:master

and you'd never have seen this, because the branch you fetched would have been named the default 'master' in the first place).

		Linus
Previous: Jakub NarebskiNext: Bill Lear
Message 8 of 22 in “Why is git clone not checking out files?”
  1. Bill LearJan 30, 2007
  2. Jakub NarebskiJan 30, 2007
  3. Bill LearJan 30, 2007
  4. Shawn O. PearceJan 30, 2007
  5. Bill LearJan 30, 2007
  6. Linus TorvaldsJan 30, 2007
  7. Jakub NarebskiJan 30, 2007
  8. Linus TorvaldsJan 30, 2007
  9. Bill LearJan 30, 2007
  10. Johannes SchindelinJan 30, 2007
  11. Bill LearJan 30, 2007
  12. Bill LearJan 30, 2007
  13. Bill LearJan 30, 2007
  14. Bill LearJan 30, 2007
  15. Jakub NarebskiJan 30, 2007
  16. Jakub NarebskiJan 31, 2007
  17. Bill LearJan 30, 2007
  18. Shawn O. PearceJan 30, 2007
  19. Jakub NarebskiJan 30, 2007
  20. Bill LearJan 30, 2007
  21. Linus TorvaldsJan 30, 2007
  22. Linus TorvaldsJan 30, 2007

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.