Source tree cannot see feature branch created from a project branch
Asked by Xintong Wang:

Hi,

A clone of a project branch was made to my local drive and opened using Sourcetree. I then created a new feature branch from this project branch in JIRA and both branches are hosted in Bitbucket. However, Sourcetree seems unable to see the remote feature branch at all. I tried 'git fetch' , 'git checkout \<feature_branch\>'but still could not get the feature branch show up in Sourcetree.

I tried both Sourcetree and git command but neither worked. When I click 'Checkout in Sourcetree' next to the name of feature branch in Bitbucket, there is an error message showing 'origin/feature_branch is not a commit and a branch cannot be created from it'.

Could you please suggest what I need to do to to get the feature branch created from a project branch?

Thanks.

Xintong


Answers:
author: minnsey
body: Hi  

Can I ask where you see the *origin/feature_branch is not a commit and a branch cannot be created from it* error, in Sourcetree or Bitbucket?  

If from the command line/terminal you run  

\>git branch

You will see a list of all the local branches you have checked out.  

If you run   

\>git branch --remote

you will see a list of all the branches available on the remote.  

Can you see the branch you want in the remote list?  

If it is you should be able to check it out  

see <https://www.git-scm.com/book/en/v2/Git-Branching-Remote-Branches>

comments: author: Xintong Wang
body: Hi Michael,

Thanks for your reply.

I saw that error message in Sourcetree after clicking '**Check out in SourceTree**' (in a dropdown) next to the feature branch name in Bitbucket. Please see attached screenshot.

*git branch --remote* does not show this feature branch in Bash, although the branch shows up in Bitbucket.

The feature branch also does NOT show under REMOTES/origin in Sourcetree (left panel). Only the master branch is there.

![bitbucket.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/18916i8590D7BEAF30D679/image-size/large?v=v2&px=999 "bitbucket.jpg")


author: minnsey
body: That sounds odd.  
Are all other branches visible apart form this one?  
Are there any permissions at work?


author: Xintong Wang
body: I just created a new feature branch from the project branch for another JIRA ticket. I can see it in Bitbucket, however still the same, ***git branch --remote*** can only see the project branch but cannot find this new feature branch. And this new feature branch does not show up in REMOTES/origin in Sourcetree. 'Check out in Sourcetree' as mentioned above showed the same error message... 'this is not a commit and this branch cannot be created.'


author: Xintong Wang
body: BTW, I do not think there is a permission issue. Alternatively I found I could use **git checkout -b feature-branch** to pull it down to local repository. But just let you know the issue is still there.


author: Ben McCallum
body: This just happened to me to. Bizarre. Appears in Branches page of web UI, but no amount of \`git fetch\` would have it appear in VS's Team Explorer listing of branches, and trying to do \`git checkout\` would say "error: pathspec 'branch-name' dit not match any file(s) known to git".

Went for -b above and will see how I go pushing it back up.


Tags: bitbucket

jira