-1

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?

3

2 Answers 2

1

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.

1
  • How would it guarantee the first two ones will not be deleted.?
    – Ahmad
    Aug 1, 2013 at 13:38
1

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

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