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

How to delete a branch on Bit Bucket that has been deleted locally?

Zoabis January 5, 2013

This didn't help:

git push repository :branch

Any body know how?

Thanks

3 answers

1 accepted

4 votes
Answer accepted
aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 7, 2013

Hello,

This syntax is correct

git push repository :branch

In this case, repository is referring to the alias you configured when you setup your git remote initiall or recently. The default if you don't specify one is origin. In other words, your command should look like:

git push origin :{branch_name}

You can confirm what the alias is by looking at the contents of the file .git/config or by running the command

git remote -v

In that listing you'll see the alias and URL. That is the configuration of the URL alias to your remote. For more information about git remotes, see the official documentation.

If you still have more questions about the usage of git in general, please ask it here. We'd love to continue to share this information with the community!

Zoabis January 7, 2013

Hi Marcus,

Sorry but that command gives the following error:

David-Chamberss-MacBook-Pro:ZS1 davidchambers$ git push origin :2013_Develop_ZS1_into_MIDI_Metrics_Tool_
Password:
error: unable to push to unqualified destination: 2013_Develop_ZS1_into_MIDI_Metrics_Tool_
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'https://Zoabis@bitbucket.org/Zoabis/zs1.git'

:-(

Any ideas?

Thanks for trying

aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 7, 2013

This means that git doesn't know what branch you are referring to. I took a look at your repo, and it would appear that your branches full name includes (free) in it. You can check this by running

git branch -a

Maybe try copy/pasting the exact full name of the branch? When you are pushing up this change, keep in mind the ref is quite literally a file with a reference to a commit sitting on the remote server. You need to use the exact name when referring to it.

Note with the ( and ) you may need to use \( and \) as escape characters if you are using OSX or Unix like shells.

Like Surendra Allam likes this
Zoabis January 7, 2013

Yes, thanks very much Marcus, it's fixed now. My mistake.

Cheers

1 vote
Abdulrazaq Mohammed Ali Omar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2013

Is that your main branch? You can't delete the main branch, you need to choose a different branch as the main branch then you can use the command you mentioned.

All the best

Abdulrazaq Mohammed Ali Omar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2013

If that's your Main branch you can't delete it. You'll need to go to the admin section of your BitBucket repository and select a different branch for the main branch.

Zoabis January 6, 2013

Hi Razaq,

That could be the problem. How do I change the main branch on the server? Thanks

Zoabis January 6, 2013

No, my main branch is Master.

I cd'ed to the local directory with my project and tried the follwoing and got these errors:

andrea-xps:ZS1 davidchambers$ git push ZS1 :2013_Develop_ZS1_into_MIDI_Metrics_Tool_
fatal: 'ZS1' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
andrea-xps:ZS1 davidchambers$ git push Zoabis/zs1 :2013_Develop_ZS1_into_MIDI_Metrics_Tool_
fatal: 'Zoabis/zs1' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
andrea-xps:ZS1 davidchambers$

I thought this was the URL of my repo:

https://bitbucket.org/Zoabis/zs1

??

Thanks for your help so far

pushpendra270 August 20, 2018

thanks

0 votes
Abdulrazaq Mohammed Ali Omar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2013

hmm..this is actually beyond my BitBucket experience :(. I suggest you consult our BitBucket support team at support.atlassian.com under the bitbucket project. Am sure you'll get the help you need.

Zoabis January 6, 2013

Will do. Thanks for trying anyway!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events