Skip to content

Instantly share code, notes, and snippets.

@elland
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elland/0e3a146d3b63e716157f to your computer and use it in GitHub Desktop.
Save elland/0e3a146d3b63e716157f to your computer and use it in GitHub Desktop.
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