Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a repo in bitbucket, and i am using git.

So my branches are

master
develop_one
develop_two

When i use git clone git@bitbucket.org:project/project.git, i am getting only the master branch code, but i need to clone/pull only develop_one branch, so how to clone/pull only develop_one branch code ?

Note: The other branches(develop_one, develop_two) are not merged in to master, and dont want to merge until the functionality has been completed actually, so want to get/clone/pull only a specific branch code

question from:https://stackoverflow.com/questions/20033863/pull-specific-branch-from-git

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
582 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try:

git clone git@bitbucket.org:project/project.git -b develop_one --single-branch

For already cloned repos use:

git fetch
git checkout develop_one
# Or more specific:
git checkout --track -b develop_one

This will track the develop_one branch from the remote.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...