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, 20:00 UTC
Message-ID
<Pine.LNX.4.64.0701301153580.3611@woody.linux-foundation.org>
In-Reply-To
<Pine.LNX.4.64.0701301123300.3611@woody.linux-foundation.org>
On Tue, 30 Jan 2007, Linus Torvalds wrote:
Show 6 quoted lines
> 
> So either use
> 
> 	git --bare fetch git://source/public/project topic:master
> 
> (to tell git to fetch the remote 'topic' into the local 'master')

Side note: it's usually a good idea to have a 'master' branch, not so much because git itself really cares (it's just a default, after all, in a technical sense), but more because NOT having a master branch may then end up confusing other people who try to access the repository, and it doesn't have the normal default branch.

Show 5 quoted lines
> OR, if you just prefer using the 'topic' name - which is certainly not 
> wrong at all, do
> 
> 	git --bare fetch git://source/public/project topic:topic
> 	git --bare symbolic-ref HEAD refs/heads/topic

And another note on this. I did do that with a special command, and yes, th is is what you should do in a script. HOWEVER, as with .git/config, I really think it's probably just easier to open your editor on the HEAD file directly, and just do that renaming by hand.

I _like_ people being able to just open files and mucking with them. It's considered extremely bad form in CVS (yeah, people _do_ actually open the CVS internal *,v files and muck with them, and it's a horrible horrible thing to do, but sometimes people have reason to do it), but in git, all the files you really *really* must not try to edit are compressed binary files and are protected by really strong checksums etc, so I don't think it's wrong to encourage people to edit files under .git/ by hand.

The things that can be edited are perfectly fine to edit. You can screw things up, of course, but on the other hand, I think people can really get a much better feeling for what git does if they end up understanding the files that git depends on.

So by all means, get down and dirty, and just fire up your editor on .git/HEAD when you want to create a repository that has some other default HEAD than 'master'.

		Linus
Previous: Linus Torvalds
Message 22 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.