What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-03 08:08:16
remove all branches deleted on remote
# set this alias in git.config git config --global alias.gone "! git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '\$2 == \"[gone]\" {print \$1}' | xargs -r git branch -D" # then run git gone Add solution -
Other 2021-09-03 06:30:02
remove deleted remote branches locally
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 Add solution
Best helpers
Ranking is empty