Supprimer les branches qui ne sont pas dans le référentiel local en utilisant git
Question
Il y a un tas de branches sur un de mes repo git que je suis quand je sur GitHub fourchue. Je ne veux pas que ma fourchette GitHub avoir ces branches.
Est-il possible que je peux supprimer toutes les branches sur mon repo GitHub qui ne sont pas dans mon repo local?
La solution
git push --mirror <origin>
fera les refs sur le match à distance ceux du référentiel local, y compris la suppression de branches que vous n'avez pas localement.
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.
Autres conseils
Vous pouvez supprimer des branches poussant à distance mon une branche vide:
$ git push origin :branch-to-delete
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow