how to list all the branches in a git repo

this seems to work reliably:

git ls-remote --heads

a little cleaner:

git ls-remote --heads 2>/dev/null | sed 's|.*heads/||' >all.branches

these are not 100% reliable (tested and lost):

git branch -r
git branch -a
git remote show origin