Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 18 lines (16 sloc) 485 Bytes
#!/bin/sh
# Clean all files that are ignored and not tracked, but exclude those listed in .gitexcept file.
# Example:
# git clean-except
except=`cat .gitexcept | tr -d '\r' | tr '\n' '|' | sed "s/|$//"`
files="git ls-files -o -i --exclude-standard"
count=`$files | egrep -v $except | wc -l`
if [ $count -eq 0 ]
then
echo "Already clean!"
else
echo "Deleting these files:"
$files | egrep -v $except
$files | egrep -v $except | xargs rm
echo "$count files cleaned."
fi