for REF in $(git for-each-ref --format='%(refname)'); do
    git update-ref -d "$REF"
done