Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove remote branches in Git [duplicate]

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?

like image 513
Airam Avatar asked Jul 19 '13 10:07

Airam


1 Answers

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.

like image 51
Jan Krüger Avatar answered Sep 19 '22 21:09

Jan Krüger