Search code examples
gitbitbucketatlassian-sourcetree

Cloning a repo in Sourcetree from inside BitBucket, not all of local branches get created


I'm trying to show how to clone a repo, from BitBucket into Sourcetree. I have a repo, called testhelp. There are two branches in repo: main and JIRA-1234. I select the Clone button, and then select into Sourcetree. At that point, it gives me the choice of which branch to select to have cloned. I wanted all of them to be created locally. (It seems to recognize the remote version of the branch.)
To get around it, I've had to do a git checkout <missing
branch> at the CLI to get the local version of the remote branch. Should Sourcetree allow me to do this, and copy all the branches down?

Thanks,

Russ

I tried the above steps and got the above results.


Solution

  • The branch to select is the one that will be checked out right after cloning. Nothing keeps you from changing it after with git checkout like you did. All the branches are accessible after a clone, no need to clone again.

    Here is a link to the Clone a repository into SourceTree tutorial page where you can see different methods to clone a repository. The Method #2 seems to be the one you did:

    Step #1 - Click Clone in SourceTree

    enter image description here

    Step #2 - Fill the fields and click Clone

    enter image description here

    As you can see in Step #2, the master branch will be checked out. In your case, if you wanted another branch to be checked out after cloning, you could have selected it there.