views:

202

answers:

1

Backround:

Suppose I have the following Git URLs (hosted on github)

http://github.com/mikl/drupal.git
git://github.com/mikl/drupal.git  (Git read-only)

I am interested in having a local copy of this repository so I can pratice working with branches in git and see how my local working tree can change depending on which branch I am working with.

Questions:

  1. To get started, I set up a local directory and do git clone git://github.com/mikl/drupal.git ... Will this clone all of the branches? Or will it only clone master?
  2. The web front-end for github gives me a "drop down" menu that allows me to switch branches ... Does changing this drop-down actually change which branch I will be grabbing when I run git clone?
  3. If I want a new copy of this repository on my local machine, but I am interested in only two branches of this repository and I want to ignore all the rest, what command do I use to ensure I clone only those two branches and nothing else (assume one of the branches is master)?
+4  A: 
  1. It will clone all of the branches. However, there will be no local branches created for anything but master. You can view the remote branches with git branch -r and create a local tracking branch with git branch localname origin/remotename
  2. No.
  3. A multi-step process, which I suggest you don't bother with (create repository, set up a remote, do partial fetches of the remote).
Yann Ramin