Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

This question already has an answer here:

When I do git ls-remote to my remote repository it shows:

HEAD
refs/heads/BranchA
refs/heads/master
refs/remotes/origin/BranchA
refs/remotes/origin/master

How can I delete the last two entries?

share|improve this question

marked as duplicate by larsks, Mario Sannum, Wouter J, poke, VonC Mar 1 '14 at 18:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
2  
Not just a duplicate, but Google for "git delete remote branch" seems to yield lots of results, too. – larsks Aug 1 '13 at 13:27
    
I fear the first ones will deleted...these post doesn't answer that – Ahmad Aug 1 '13 at 13:38

You can do this by pushing an empty ref, so:

git push origin :BranchA :master

will do the trick. If you follow that with a 'git fetch --prune origin', then they won't show up in 'git branch -a' either.

share|improve this answer
    
How would it guarantee the first two ones will not be deleted.? – Ahmad Aug 1 '13 at 13:38

Simplest answer I found on SO itself and it worked like a charm.

git push repository :refs/remotes/origin/BranchA

git push repository :refs/remotes/origin/master

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.