Skip to content

Instantly share code, notes, and snippets.

Last active Dec 19, 2015
What would you like to do?
Prevent pushes that break the build.
# Requires git 1.8.2 or above. This excludes `git` from Xcode 4.6, but should include `git` from Xcode 5 and homebrew.
# Not perfect. If you've done anything since your last commit that breaks the build, this will incorrectly fail. Maybe do something like +
# Install by adding this file into .git/hooks, naming it `pre-push`
# go into the dir that contains the xcodeproj
cd Foo
# build the xcodeproj for your scheme (and/or configuration)
xcodebuild -scheme Foo
# if we built successfully, exit 0 and push
if [ "$?" = 0 ]; then
exit 0
# otherwise, exit non-0 and prevent the push.
exit -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment