Created
March 3, 2016 21:59
-
-
Save pgjones/6a8b1d21d19e064395d3 to your computer and use it in GitHub Desktop.
Pre push hook to prevent push of commits less than 30 mins old
This file contains hidden or 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
#!/bin/bash | |
commit_timestamp=$(date -d @$(git log -n1 --format="%at") +%Y%m%d%H%M) | |
now=$(date +%s) | |
difference=($now - $commit_timestamp) | |
max=$((30 * 60)) | |
if [ "$difference" -lt "$max" ] | |
then | |
echo "Too soon" | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment