A branch was created unintentionally. I want to delete it. In fact, I thought I deleted it last week, and it doesn't show up in searches on bitbucket, so I'm inclined to think the problem is just in my local repo. Why does the branch still show up in my local repo after doing this?
$ git branch -d ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
error: branch 'ebc_193_157_154_order_creation_xsd_validation_and_refactored_code' not found.
$ git push bitbucket :ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
error: unable to delete 'ebc_193_157_154_order_creation_xsd_validation_and_refactored_code': remote ref does not exist
error: failed to push some refs to 'bitbucket.org:trueaction/eb2c'
And still it remains:
$ git branch -r | grep ebc_193
bitbucket/ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
$ git branch -a | grep ebc_193
remotes/bitbucket/ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
What must I do to be rid of it?
You are looking for git remote prune
which removes stale remote branches.
Deletes all stale remote-tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/".
With --dry-run option, report what branches will be pruned, but do not actually prune them.
In your situation, you'll want to use git remote prune origin
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With