Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pre_push git hook which invokes synx script before every push

Instalation

To install this hook you have to create a pre_push file inside .git/hooks/ and paste there the script written below. Next you have to set execute permisions with following command:

$ chmod a+x pre_push

Don't forget to change the project name inside the script.

git_status_before_synx=$(git status)
synx -q <projectName>.xcodeproj
git_status_after_synx=$(git status)
if [ "$git_status_before_synx" != "$git_status_after_synx" ]
then
git add --al
git commit -am "Runs synx to change the strucutre of directory"
echo "Synx changed the structure of the directory. Push the changes ones again"
exit 1
else
echo "Synx has not changed anything. Pushing..."
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment