Skip to content

Instantly share code, notes, and snippets.

@coccoinomane
Created January 15, 2016 19:09
Show Gist options
  • Save coccoinomane/d0e16414b439241015a0 to your computer and use it in GitHub Desktop.
Save coccoinomane/d0e16414b439241015a0 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Git hook script to remove the annoying Icon? files created
# by Google Drive.
n_icon_files=`find . -name Icon? | grep -c /`
if [ $n_icon_files != "0" ]; then
echo "Will delete $n_icon_files files 'Icon?' generated by Google Drive\n"
find . -name Icon? -exec rm -f {} \;
fi
@coccoinomane
Copy link
Author

This simple bash script allows you to use a git repository inside the Google Drive folder.

The script automatically and recursively deletes all Icon? files created by Google Drive in your .git folder before every commit. These files would otherwise potentially mess up your git repository.

Place the script in the .git/hooks folder of your project. I also advise to do the following:

cp .git/hooks/pre-commit .git/hooks/pre-push

which ensures the files are deleted also before every git push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment