Skip to content

Instantly share code, notes, and snippets.

@woodnathan
Last active June 30, 2016 07:14
Show Gist options
  • Save woodnathan/9a49478c5c20d212f5096d4a7ec2e8fd to your computer and use it in GitHub Desktop.
Save woodnathan/9a49478c5c20d212f5096d4a7ec2e8fd to your computer and use it in GitHub Desktop.
xUnique pre-commit script
#!/bin/bash
echo "pre-commit xunique script start"
while read line
do
if [[ $line =~ .*project.pbxproj$ ]]
then
pbxprojPath="$line"
[ -e "$pbxprojPath" ] && xunique -c "$pbxprojPath"
if [ $? -ne 0 ]
then
[ -f "$pbxprojPath" ] && git add "$pbxprojPath"
echo "Added '$pbxprojPath' to commit"
fi
fi
done < <(git diff --name-only --cached)
echo "pre-commit xunique script end"
@woodnathan
Copy link
Author

Heavily inspired by the pre-commit script for https://github.com/neciu/SOCK

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