Modifications to make pre-commit hooks safe

Modifications suggested by:
      http://tech.yipit.com/2011/11/16/183772396/
      http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/#comment-645959940