Skip to content

Instantly share code, notes, and snippets.

Last active June 1, 2016 17:40
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
pre_push git hook which invokes synx script before every push


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" ]
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
echo "Synx has not changed anything. Pushing..."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment