Skip to content

Instantly share code, notes, and snippets.

@coogie
Created July 16, 2015 11:08
Show Gist options
  • Save coogie/96d34d70c7f7a671d6da to your computer and use it in GitHub Desktop.
Save coogie/96d34d70c7f7a671d6da to your computer and use it in GitHub Desktop.
A pre-commit hook to catch filename conflicts because hurr durr Windows
#!/bin/bash
# Save current state
git stash -u -q --keep-index || exit 1
# Get the list of clashing files in the whole repository
CLASHING=`find "$(git rev-parse --show-toplevel)" | sort | uniq -d -i`
# Restore previous state
git stash pop -q
if [[ $CLASHING ]]; then
echo "Found clashing files on case-insensitive file systems"
echo "$CLASHING"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment