Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

unable to create new branches: not through the bitbucket cli and not through terminal

Lottan Horev October 21, 2021

Hi everyone,

yesterday I couldn't create new branches that connected to the master in all my projects that exist on bitbucket. 

when I create a branch through the bitbucket client, it gives me on the "checkout" command line, only the name of the new branch "feature/foo" and not the regular "git fetch && checkout feature/foo" - the branch exists, but I cant perform checkout to it.

when I simply try "git checkout -b feature/foo" on the terminal when I am in the master branch, it creates a new branch, but without upstream and I can't push it or create a pull request.

Has someone had this problem before? can help on how to solve it? 

thank you all,

1 answer

1 accepted

0 votes
Answer accepted
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2021

Hi, @Lottan Horev! Welcome to the community! 

First of all, I would like to confirm that recently, the git checkout command has been removed from our UI due to vulnerability reasons. We understand that this may impact the workflow for some developers, so we have already created a feature request to add the git checkout command to the UI again as you can check here: 

Now, going back to the problem you have reported about not being able to create new branches, you mentioned that after you created the branch on your remote repository, you ran the command "git checkout -b feature/foo". Indeed, it will create a new branch, however without upstream and you won’t be able to push it or create a pull request.

In order to solve this issue, instead of running the command "git checkout -b {branch_name}" when you want to check out a remote branch, you need to run the following command:

git fetch && git checkout {branch_name}

This way, the branch will be set up to track the remote branch from origin and you will be able to push its content when you need to do so.

Please let me know how it goes and feel free to share any additional questions or concerns regarding this case.

Kind regards,
Caroline 

Lottan Horev October 24, 2021

Hi Caroline,

Thank you for your answer, still, when I try your solution I get this error:

repo git:(master) ✗ git fetch && git checkout feature/foo
error: pathspec 'feature/foo' did not match any file(s) known to git

 

do you have any recommendations for this scenario?

thanks,

Lottan

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2021

Hi, Lottan

Thanks for getting back to me. I was only able to reproduce this error when the branch did not exist either in the remote or in the local repository. In this case, I would like to ask you a few things:

  • Could you please confirm if the branch is created in the remote or in the local repository?

  • Could you please check if the remote repository set in your local repo is correct? You can run the following command to verify that:

git remote -v
  • If everything is correct: the branch exists in the remote repository and the remote is correctly set in your local repo, could you please run the following commands and let me know how it goes?

git remote update
git fetch 
git checkout feature/foo

Looking forward to hearing from you.

Kind regards,
Caroline

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events