Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,580
Community Members
 
Community Events
165
Community Groups

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

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 Oct 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 

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 Oct 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
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,262 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you