git - Retirer les branches de traçage à distance

Mots clés : gitgit-branchgit

meilleur 2 Réponses git - Retirer les branches de traçage à distance

vote vote

92

git branch --merged >/tmp/merged-branches && \   vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches 
vote vote

89

git fetch -p 
git branch -vv 
$ git branch -vv   master                 b900de9 [origin/master: behind 4] Fixed bug   release/v3.8           fdd2f4e [origin/release/v3.8: behind 2] Fixed bug   release/v3.9           0d680d0 [origin/release/v3.9: behind 2] Updated comments   bug/1234               57379e4 [origin/bug/1234: gone] Fixed bug 
git fetch -p && for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D $branch; done 
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done 

Questions similaires