SourceTree - how to checkout to remote repo branch
Asked Answered
A

2

31

I create a new branch in remote GIT repository. Repository stored on BitBucket.

In my my local repository I can see this new branch with SourceTree. It appears in commits list, on same commit I create branch from. But I cannot see this new branch under branches list and cannot checkout it.

I want to checkout and push updated on my local workstation code to remote repository back, but within exactly this new branch. I started development on same branch, what was source to clone new branch.

I tried to pull this new branch. It is empty as it should, but it still not under branches list and I cannot checkout it.

How to commit to this new branch?

Araucania answered 26/10, 2016 at 12:29 Comment(0)
S
64

With SourceTree (1.9.6.1) alone (not talking about the command-line here), make sure:

  • you have fetched the repo
  • your log view is set to "All Branches" (not "current branches")
  • "Show Remote Branches" is selected

Note: the BRANCHES section at the left side of the log view only display local branches, not the remote ones.
The remote branches are list in the REMOTES/origin section, just below BRANCHES and TAGS.

By double-clicking on the remote branch, you can create a new local branch.

checkout new branch from remote tracking branch

Serajevo answered 26/10, 2016 at 12:42 Comment(8)
Looks like this should help. I have no idea about remote branches are under origin, so was not able to checkout any of them. Thanks.Araucania
Looks like this is no longer there in SourceTree v2Jurywoman
@K48 I am with SourceTree 2.5.5 very latest edition (June 2018) and I see exactly what I described in the answer (when double-clicking on a remote branch which is not the one currently checked out)Serajevo
Note to self: this is my 400th Guru badge.Serajevo
finally an explanation of this in Sourcetree, thanks!Cates
While I found that you COULD do this on REMOTES > origin I found that REMOTES > origin (scroll through hundreds/thousands of branches to find the one I want to check out) to be a more than a bit painful - I could see no way to "type and filter somehow:" using the UI there. (vers 3.3.8)Rollandrollaway
When I try to Check Out in Sourcetree from our bitbucket server Sourcetree just crashesRollandrollaway
@MarkSchultheiss I suspect you would need to change the local repo [refspec](https://mcmap.net/q/223752/-git-what-is-quot-refspec-quot/6309 in order to [fetch less branches](https://mcmap.net/q/470878/-is-it-possible-to-use-filters-in-refspec-in-places-other-than-directory-namespaces/6309, making the remote selection and subsequent checkout possible.Serajevo
S
0

You can also go to the lower part of the left side and you should see all the remotes there. Double click on the one you want to check out.

Sanguinaria answered 3/7 at 23:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.