Skip to content

Instantly share code, notes, and snippets.

@Gerg
Last active August 29, 2015 13:56
Show Gist options
  • Save Gerg/8925865 to your computer and use it in GitHub Desktop.
Save Gerg/8925865 to your computer and use it in GitHub Desktop.

Git Pair Timeout

Simple pre-commit hook to block commits if you haven't paired in the last 9 hours.

Setup

  1. Add the correct path to your .gitconfig file on line 5
  2. Put the script in your repo's .git/hooks/ directory
Acknowledgments

Built at Pivotal Labs

#!/bin/sh
#
# pre-commit hook to force running git-pair at least once per working day
#
export `stat -s <PATH TO .gitconfig>`
let now_time=(`date +%s`)
let diff=(now_time - st_mtime)
let hours=(diff/3600)
if [ $hours -gt 9 ]
then
echo "You need to pair!!"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment