Skip to content

Instantly share code, notes, and snippets.

@michiel

michiel/clean-git.sh

Created Oct 27, 2020
Embed
What would you like to do?
clean out git directories to free up space
#!/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