• Community
  • Products
  • Bitbucket
  • Questions
  • How do I delete a branch that was created after using the Bitbucket edit/create pull request function (delete branch option is greyed out)?

How do I delete a branch that was created after using the Bitbucket edit/create pull request function (delete branch option is greyed out)?

We have a branch in a git repo on our Bitbucket that we are unable to delete ("Delete branch" option under the gear icon is greyed out). Not sure if this is specific to what we did to create it but I'd like to figure out how we can delete it.

The branch originally got created by using the Bitbucket online editor, then committing and checking the "create pull request from commit" option. We then tested by declining the pull request.

Shouldn't we be able to still delete this branch? If so, how? (git commands for doing this would be acceptable, I'm still fairly new to git and none of the branch deletion commands I've tried have worked but it's possible I'm doing them wrong).

Thanks!

2 answers

1 accepted

This widget could not be displayed.

Hi Jesse,

Thanks, I found that I needed to use a slightly different command:

git push origin :<branchName>

Not sure if that's due to a difference in versions of git, but it did work.

Thanks for your help!

-steve

This widget could not be displayed.
Jesse Yowell Atlassian Team Aug 06, 2013

Hi Steve,

You will want to use the following to delete a remote branch:

git push --origin delete <branchName>

Make sure you have the correct branch permissions set under the 'Branch management' admin menu (click on the 'gear' icon) but if this does not work, tell us, and we can look in your remote git config to make sure you don't have any flags that are preventing you from deleting a branch.

Cheers,

Jesse

git push origin --delete <branchName>

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,600 views 9 11
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you