Delete branches in Bitbucket
In addition to the answer given by @Marcus you can now also delete a remote branch via:
git push [remote-name] --delete [branch-name]
I could delete most of my branches but one looked like this and I could not delete it:
Turned out someone had set Branch permissions
under Settings
and from there unchecked Allow deleting this branch
. Hope this can help someone.
Update: Where settings are located from question in comment. Enter the repository that you wan't to edit to get the menu. You might need admin privileges to change this.
For deleting branch from Bitbucket,
- Go to Overview (Your repository > branches in the left sidebar)
- Click the number of branches (that should show you the list of branches)
- Click on the branch that you want to delete
- On top right corner, click the 3 dots (besides Merge button).
- There is the option of "Delete Branch" if you have rights.
If the branches are only local, you can use -d if the branch has been merged, like
git branch -d branch-name
If the branch contains code you never plan on merging, use -D instead.
If the branch is in the upstream repo (on Bitbucket) you can remove the remote reference by
git push origin :branch-name
Also, if you're on the Bitbucket website, you can remove branches you've pushed by going to the Feature branches tab under Commits on the site. There you'll find an ellipsis icon. Click that, then choose Delete branch. Just be sure you want to drop all the changes there!