Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pre-Commit Git Hook to remove Reveal.framework references.
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"
if git diff --staged --name-only --quiet; then
echo "No files to commit after removing Reveal references"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment