Prevent pushes that break the build.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 https://twitter.com/drance/status/354365644147392513 + https://twitter.com/cbarrett/status/354372047062835201)? | |
# Install by adding this file into .git/hooks, naming it `pre-push` | |
#!/bin/sh | |
# 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 | |
fi | |
# 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