Skip to content

Instantly share code, notes, and snippets.

@GiullianoRossi1987
Last active April 19, 2020 14:05
Show Gist options
  • Save GiullianoRossi1987/34613af5255296de3ead39a831187736 to your computer and use it in GitHub Desktop.
Save GiullianoRossi1987/34613af5255296de3ead39a831187736 to your computer and use it in GitHub Desktop.
Removes the cache files on .gitignore, whereever you are.
#!/bin/bash
# HELLO! I made that function in bash to help me when i must clean the folders and files on my .gitignore
# I made it to work in any application with the root path
function cleanGitIgnore(){
for itemIgnore in $(cat .gitignore); do
# edit - 2020-04-19
if [ $1 == "-y" ]
then
git rm -r --cache $itemIgnore
continue
else
while :
do
echo -e "Do you want to remove \033[33;5m$itemIgnore \033[0mfrom git? [Y/N]"; read resp
if [ $resp = "Y"]
then
git rm -r --cache $itemIgnore
break
else
if [ $resp = "N" ]
then
break
else
echo "Sorry, i didn't understood. Please try again"
fi
fi
done
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment