22

I have repo in bitbucket. it has 2 branches master and Branch9_Artiflex but when I clone this repo to my local repo via source tree (clone-clone in source tree) i'm able to see only master branch.

Create new branch Branch9_Artiflex on my local machine and pull all data from remote Branch9_Artiflex doesn't work because they have different history of commits

source tree enter image description here

but my remote repo has 2 branches enter image description here

Emmanuel DURIN
  • 4,803
  • 2
  • 28
  • 53
ketchyn
  • 504
  • 3
  • 6
  • 16
  • Possible duplicate of [How to clone all remote branches in Git?](http://stackoverflow.com/questions/67699/how-to-clone-all-remote-branches-in-git) – mkrieger1 Feb 06 '17 at 17:56

2 Answers2

34

You can do this with the git cli as well as directly in SourceTree UI. Expanding REMOTES > origin was very close: You need to double click on the remote branch there, in your case _Branch9_Artiflex_. Then the following popup appear:

enter image description here

This would clone the remote branch staging to a local branch with the same name. Click OK, then SourceTree will fetch the RemoteBranch and it appears on your local branches tree (sidebar left):

enter image description here

Daniel
  • 968
  • 3
  • 13
  • 32
12

Try

  • git fetch . This would fetch any missed remote branch to local repository (assuming there's no other problem).
  • git checkout Branch9_Artiflex. Now you will be switched into a local/Branch9_Artiflex which is newly created with the latest changes of origin/Branch9_Artiflex. :))
Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
  • 1
    after fetching i still wasn't able to see all branches(git branch) but git checkout Branch9_Artiflex either created new branch or switched to existing one. After pulling all changes from remote Branch 9 Artiflex branch to local they seems to be the same – ketchyn Feb 07 '17 at 08:26
  • 1
    @ketchyn very strange it didn't show all branches. Anyhow git checkout Branch9_Artiflex should have created a new branch for you which consists of changes in same remote branch, so your pull worked well. Possibly you were having some problem with update indexing in git configs. Anyway nice to see you were able to solve the issue. :)) – Supun Wijerathne Feb 07 '17 at 08:32
  • 2
    I also wasn't able to see all branches, but after reading above comment I did a search and this answer https://stackoverflow.com/a/25941875/5186384 solved it for me – harveyAJ May 09 '19 at 09:38