Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SourceTree - how to checkout to remote repo branch

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?

like image 735
Pavlo Morozov Avatar asked Oct 26 '16 12:10

Pavlo Morozov


People also ask

How do I checkout a remote branch in Sourcetree?

If you're using Sourcetree, Bitbucket gives you a single button checkout. In the repository's Branches, click the branch you want to checkout. Press the Check out button to display the appropriate check out command.

How do I checkout to a remote branch?

In order to checkout a remote branch you have to first fetch the contents of the branch. In modern versions of Git, you can then checkout the remote branch like a local branch. Older versions of Git require the creation of a new branch based on the remote .

How do I pull to another branch in Sourcetree?

Pull changes from a remote repositoryClick the Pull button in the toolbar. Select the remote repository to pull from. Select the remote branch to pull changes from. Click OK.


1 Answers

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

like image 162
VonC Avatar answered Oct 03 '22 09:10

VonC