Skip to content

Instantly share code, notes, and snippets.

@thomasruiz
Created June 6, 2016 11:12
Show Gist options
  • Save thomasruiz/ed6cfd152508909ff31ab0753b1433e1 to your computer and use it in GitHub Desktop.
Save thomasruiz/ed6cfd152508909ff31ab0753b1433e1 to your computer and use it in GitHub Desktop.
RM alias to confirm when directory has a git repository
rm() {
export RM_VALIDATION='y'
for i
do
if [[ $i[1] != '-' ]]; then
if [[ -n `find $i -name .git` ]]; then
echo -n "There is a git repository. Are you sure? (y/N) "
read RM_VALIDATION
break
fi
fi
done
if [[ $RM_VALIDATION == 'y' ]]; then
/bin/rm $*
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment