La respuesta actualmente aceptada no me ayudó porque no tenía una referencia en el repositorio remoto para eliminar, ¡estaba puramente en mi local! Entonces, si se encuentra en esa situación, esto es lo que debe hacer:
Este es el problema al que me enfrentaba:
$ git fetch origin
error: cannot lock ref 'refs/remotes/origin/fix/sub-branch':
'refs/remotes/origin/fix' exists; cannot create
'refs/remotes/origin/fix/sub-branch'
From <repo URL>
! [new branch] fix/sub-branch -> origin/fix/sub-branch
(unable to update local ref)
Probé la sugerencia de la respuesta aceptada pero obtuve esto:
$ git push origin :fix
error: unable to delete 'fix': remote ref does not exist
error: failed to push some refs to <repo URL>
Así que el árbitro ni siquiera existía en origin- claramente estaba merodeando en algún lugar de mi repositorio local. Entonces corrí $ git remote show me, lo que produjo:
Remote branches:
...
refs/remotes/origin/fix stale (use 'git remote prune' to remove)
...
Lo que luego dejó clara la solución:
$ git remote prune origin
Pruning origin
URL: <redacted>
* [pruned] origin/fix
Con esto, el problema desapareció:
$ git fetch origin
remote: Counting objects: 5, done.
remote: Total 5 (delta 2), reused 2 (delta 2), pack-reused 3
Unpacking objects: 100% (5/5), done.
From <repo URL>
* [new branch] fix/sub-branch -> origin/fix/sub-branch