Created
October 27, 2020 11:07
-
-
Save michiel/929970fad1b1f0427805456599d30905 to your computer and use it in GitHub Desktop.
clean out git directories to free up space
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/bash | |
# Clean out git repos to save space | |
for d in `find . -maxdepth 1 -type d` | |
do | |
pushd . > /dev/null | |
cd "$d" | |
echo "Trying $d" | |
if [ -d .git ] | |
then | |
git clean -fxd . | |
else | |
echo "Not a git repo - $d" | |
fi | |
popd > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment