Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Add a small tool to clean git branches
Browse files Browse the repository at this point in the history
  • Loading branch information
nickstenning committed Jan 29, 2013
1 parent f0c154e commit 899fd34
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/git-clean-branches
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -eu

# Prune branches no longer present upstream
git remote prune origin

# Prune local (and remote-tracking) branches other than master, preview, and
# release
git for-each-ref refs/heads --format '%(refname)' |
egrep -v '^refs/heads/(master|preview|release)$' |
while read refname; do
git branch -d "${refname#refs/heads/}" || true
done

0 comments on commit 899fd34

Please sign in to comment.