Created
November 1, 2012 12:50
-
-
Save mAu888/3993450 to your computer and use it in GitHub Desktop.
git safe clean
This file contains 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 | |
# Place this script under /usr/bin or /usr/local/bin | |
# and make it executable with sudo chmod +x /path/to/the/script/git-sclean | |
# | |
# Run git sclean from terminal and be happy! | |
# Dry-run git clean | |
git clean -n | |
CLEARFILES=$(git clean -n | wc -l | sed 's/[^0-9]*\([0-9]*\)[^0-9]*/\1/') | |
echo -n "Clean $CLEARFILES files (y/n)? " | |
read yesOrNo | |
if [ "$yesOrNo" = "y" ]; then | |
git clean -f | |
else | |
echo "Aborting cleanup..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment