Skip to content

Instantly share code, notes, and snippets.

@michiel
Created October 27, 2020 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michiel/929970fad1b1f0427805456599d30905 to your computer and use it in GitHub Desktop.
Save michiel/929970fad1b1f0427805456599d30905 to your computer and use it in GitHub Desktop.
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