I\'m just getting started with git and I have a question. My app has 10 other developers working on it, each one having their own branch like dev_XXXXX. So if I do a clone o
If you clone, all revisions in all branches are cloned along, but the cloned repository will check out master by default.
Just taking selected branches is trickier since git does not really think you should work that way. You have to pull down the branches manually:
mkdir repoclone
cd repoclone
git init
git remote add origin git://remote/url
git fetch origin master:master
git fetch origin dev_XXX:dev_XXX
Above is what I knew worked. However, if you want to set up a git repo that works as normal, just has a more narrow view of its remote branches? You can do that pretty easily:
mkdir repoclone cd repoclone git init git remote add origin git://remote/url # now open .git/config for editing in your editor # replace the following line (grab all remote branches) fetch = +refs/heads/*:refs/remotes/origin/* # replace with lines listing exactly which branches you want fetch = +refs/heads/master:refs/remotes/origin/master fetch = +refs/heads/dev_XXX:refs/remotes/origin/dev_XXX # save the file, now run git fetch