Created
April 27, 2019 00:10
-
-
Save Denton-L/3f1b0f4bf1e91ce2e22d9156441462f4 to your computer and use it in GitHub Desktop.
clear-stale.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git ls-remote --heads "$1" | | |
cut -f2 | | |
sed -e 's|refs/heads/||' | | |
while read b | |
do | |
if [ `git rev-list --count "$2".."$1/$b"` -eq -0 -a "$b" != "$2" ] | |
then | |
echo $b | |
fi | |
done | | |
xargs git push --delete "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment