Skip to content

Instantly share code, notes, and snippets.

@michiel
Created August 24, 2016 14:31
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/22a37bbeb6de0a9a1f782be22bd04580 to your computer and use it in GitHub Desktop.
Save michiel/22a37bbeb6de0a9a1f782be22bd04580 to your computer and use it in GitHub Desktop.
Clean out a directory of git repositories
#!/bin/bash
for d in `find . -maxdepth 1 -type d`
do
pushd . > /dev/null
cd "$d"
echo "Trying $d"
if [ -d .git ]
then
git clean -fdx .
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