Skip to content

Instantly share code, notes, and snippets.

@jechol
Last active May 27, 2018 14:03
Show Gist options
  • Save jechol/912acf710b02954676045b5dd9eadc23 to your computer and use it in GitHub Desktop.
Save jechol/912acf710b02954676045b5dd9eadc23 to your computer and use it in GitHub Desktop.
pre-commit
#!/usr/bin/env bash
set -e
pushd .git/hooks > /dev/null
curl -s -O https://gist.githubusercontent.com/jechol/912acf710b02954676045b5dd9eadc23/raw/71e01f0c0f4f45c97805bbabfa6d24ce64fd8fe2/pre-commit
chmod a+x pre-commit
popd > /dev/null
#!/bin/sh
cd `git rev-parse --show-toplevel`
mix format --check-formatted
if [ $? == 1 ]; then
echo "[ERROR!!!] Commit failed because you have format issues..."
echo "[SO WHAT?] Please run mix format and git add/commit again dude. ^^"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment