I want to delete some remote branches of my project repository. I've run the next command:
git push origin :name_of_branch
and when I list the remote branches with
git branch -r
the branch that I've deleted doesn't appear, but a partner of mine run
git fetch
and later
git branch -r
and in the list, the branch name_of_branch
that I had deleted, is still in the list. However, when he tries to delete the branch with
git push origin :name_of_branch
He receives the next message:
error: unable to delete 'name_of_branch': remote ref does not exist
error: failed to push some refs to 'the_name_of_the_repository'
How could I delete the branch completely of the list?
This happens because when this partner of yours runs git fetch
, the branch deletion is not "applied" to his repository. fetch
only updates and adds branches.
They can run git remote prune origin
to trim away remote branches in their list that no longer exist in the upstream repository.
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