LWN.net Logo

Advertisement

Front, Kernel, Security, Distributions, Development. See your byline here on LWN.net.

Advertise here

Can "git clone" checkout a specified branch now?

Can "git clone" checkout a specified branch now?

Posted Aug 6, 2008 15:05 UTC (Wed) by newren (subscriber, #5160)
In reply to: Can "git clone" checkout a specified branch now? by bbbush
Parent article: Git Magic

I've wanted that as well, but no, I haven't seen it in git. I've used the commands you gave sometimes, though I also once put a script together with the following commands:

git clone --no-checkout REPOSITORY
git symbolic-ref HEAD refs/heads/BRANCH
git read-tree -m -u -v HEAD HEAD

Typically users aren't supposed to be exposed to symbolic-ref or read-tree; they're low-level "plumbing" commands. But it can be useful in a script if you have a reason for wrapping git as part of some other build tool or something.


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds