-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?

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Ahmad
  • 2,110
  • 5
  • 26
  • 36
  • 1
    http://stackoverflow.com/questions/4890772/how-to-remove-remote-origin-refs-heads-master http://superuser.com/questions/283309/how-to-delete-the-git-reference-refs-original-refs-heads-master – ddavison Aug 01 '13 at 13:26
  • 2
    Not just a duplicate, but Google for "git delete remote branch" seems to yield lots of results, too. – larsks Aug 01 '13 at 13:27
  • I fear the first ones will deleted...these post doesn't answer that – Ahmad Aug 01 '13 at 13:38

2 Answers2

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.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Jamie Iles
  • 141
  • 1
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

Ahmad
  • 2,110
  • 5
  • 26
  • 36