El mejor comando para ejecutar es git remote show [remote]. Esto mostrará todas las sucursales, remotas y locales, con seguimiento y sin seguimiento.
Aquí hay un ejemplo de un proyecto de código abierto:
> git remote show origin
* remote origin
Fetch URL: https://github.com/OneBusAway/onebusaway-android
Push URL: https://github.com/OneBusAway/onebusaway-android
HEAD branch: master
Remote branches:
amazon-rc2 new (next fetch will store in remotes/origin)
amazon-rc3 new (next fetch will store in remotes/origin)
arrivalStyleBDefault new (next fetch will store in remotes/origin)
develop tracked
master tracked
refs/remotes/origin/branding stale (use 'git remote prune' to remove)
Local branches configured for 'git pull':
develop merges with remote develop
master merges with remote master
Local refs configured for 'git push':
develop pushes to develop (local out of date)
master pushes to master (up to date)
Si solo queremos obtener las ramas remotas, podemos usar grep. El comando que nos gustaría usar sería:
grep "\w*\s*(new|tracked)" -E
Con este comando:
> git remote show origin | grep "\w*\s*(new|tracked)" -E
amazon-rc2 new (next fetch will store in remotes/origin)
amazon-rc3 new (next fetch will store in remotes/origin)
arrivalStyleBDefault new (next fetch will store in remotes/origin)
develop tracked
master tracked
También puede crear un alias para esto:
git config --global alias.branches "!git remote show origin | grep \w*\s*(new|tracked) -E"
Entonces puedes simplemente correr git branches.
git fetchygit remote updateno recupera todas las ramas del mando a distancia? Porque de lo contrario, podrías buscar y luego usargit branch -r...