Eliminar las ramas que no están en el repositorio git utilizando locales
Pregunta
Hay un montón de ramas en uno de mis git repo de que me dieron cuando se bifurcó en GitHub. Yo no quiero que mi tenedor GitHub tener estas ramas.
¿Hay alguna manera de que pueda borrar todas las ramas en mi repo GitHub que no están en mi repo local?
Solución
git push --mirror <origin>
hará que los árbitros en el partido remota aquellos en el repositorio local, incluida la eliminación de ramas que no tiene localmente.
De git help push
:
--mirror Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote.<remote>.mirror is set.
Otros consejos
Puede eliminar ramas remotas mi empujando una rama de vacío:
$ git push origin :branch-to-delete
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow