Skip to content

Instantly share code, notes, and snippets.

@ChrisMarxDev
Last active July 22, 2021 08:21
Show Gist options
  • Save ChrisMarxDev/dfc022dd7c268c69381a6d0e9411b28d to your computer and use it in GitHub Desktop.
Save ChrisMarxDev/dfc022dd7c268c69381a6d0e9411b28d to your computer and use it in GitHub Desktop.
Flutter pre-push git hook. Does not push if analyse or test fail.
#!/bin/sh
# To use add to your projects `.git/hooks/`
# Should be named `pre-push`
# Don't forget to make it executable with `chmod +x`
# run Flutter analyze + test
flutter analyze
if [ $? -ne 0 ]; then
exit 1
fi
flutter test
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment