Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pre-Commit Git Hook to remove Reveal.framework references.
#!/bin/bash
git diff --cached --name-status | while read st file; do
# skip deleted files
if [ "$st" == 'D' ]; then continue; fi
# do a check only on the pbxproj file
if [[ "$file" =~ 'project.pbxproj' ]] ; then
# Remove references to Reveal.framework
sed -i '' -E 'N;s/.*Reveal.*\n(.*)/\1/' "$file"
sed -i '' -E 'N;s/(.*)\n.*Reveal.*/\1/' "$file"
git add "$file"
fi
done
if git diff --staged --name-only --quiet; then
echo "No files to commit after removing Reveal references"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.