Last active
November 22, 2022 13:46
-
-
Save pad92/82bc97c7092d6eb49835ea2ce9867825 to your computer and use it in GitHub Desktop.
Recursive git prune
This file contains 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 | |
for REPO in $(find $(pwd) -type d -name .git | sed 's@/.git@@g'); do | |
echo -ne "- ${REPO}" | |
PRUNE=$(git --git-dir=${REPO}/.git remote prune origin 2&>1 ) | |
if [ $? -ne 0 ]; then | |
echo -ne "\tERROR\n" | |
echo "$(date +"%Y%m%d-%H%M") ERROR: ${REPO}" >> prune.log | |
echo "${PRUNE}" >> prune.log | |
echo "" >> prune.log | |
else | |
echo -ne "\tOK\n" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment