Skip to content

Instantly share code, notes, and snippets.

@miquelbeltran
Created June 4, 2019 07:18
Show Gist options
  • Select an option

  • Save miquelbeltran/56b7e276f8209c46bc39644b82018587 to your computer and use it in GitHub Desktop.

Select an option

Save miquelbeltran/56b7e276f8209c46bc39644b82018587 to your computer and use it in GitHub Desktop.
Flutter pre-push hook that runs analyze and test
#!/bin/sh
# To use add to `.git/hooks/`
# Should be named `pre-push`
# Make executable with `chmod +x`
# stash any unstaged changes
git stash -q --keep-index
# run Flutter analyze + test
flutter analyze
if [ $? -ne 0 ]; then
# unstash the unstashed changes
git stash pop -q
exit 1
fi
flutter test
if [ $? -ne 0 ]; then
# unstash the unstashed changes
git stash pop -q
exit 1
fi
# unstash the unstashed changes
git stash pop -q
exit 0
@Gperez88
Copy link
Copy Markdown

Cool!

@danielRi
Copy link
Copy Markdown

danielRi commented Mar 2, 2020

Nice, thanks bro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment