Fix non-master branches and tags
Fix non-master branches and tags

This plus the test should ensure no regressions.  Git makes it tricky to do
some things on a remote that you would think to do on a local repo.
`ls-remote` gives me the info I need with only one test for "HEAD" vs anything
else.

kubernetes/git-sync,kubernetes/git-sync