Skip to content

Instantly share code, notes, and snippets.

@TheAdamBorek
Last active June 1, 2016 17:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheAdamBorek/aaff0d3a0a75af837781be0bf61d7eba to your computer and use it in GitHub Desktop.
Save TheAdamBorek/aaff0d3a0a75af837781be0bf61d7eba to your computer and use it in GitHub Desktop.
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