Domanda

C'è un mucchio di rami su uno dei miei git repo di che ho avuto quando ho biforcato su GitHub. Non voglio la forchetta GitHub di avere questi rami.

C'è un modo che io possa cancellare tutti i rami sul mio repo GitHub che non sono nel mio repo locale?

È stato utile?

Soluzione

git push --mirror <origin> renderà gli arbitri sul match a distanza quelli del repository locale, tra cui l'eliminazione di rami che non si dispone a livello locale.

Da 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.

Altri suggerimenti

È possibile eliminare filiali remote mia spingendo un ramo vuoto:

$ git push origin :branch-to-delete
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top