title: Check if commit is first commit in pre-commit hook
body: <p>Currently I'm using the pre-commit hook to disallow committing to the master branch (forces me to work on other branches and merge in changes).  This doesn't allow me to do an initial commit on a newly created repo.  I want to add a check to allow a commit on master if it's the first commit.</p>
  
  <p>I've tried multiple versions of this with no luck...</p>
  
  <pre><code>if [[ `git shortlog | grep -E '^[ ]+\w+' | wc -l | tr -d ' '` == 0 -a `git symbolic-ref HEAD` == "refs/heads/master" ]]
  then
      echo "You cannot commit in master!"
      echo "Stash your changes and apply them to another branch"
      echo "git stash"
      echo "git checkout branch"
      echo "git stash apply"
      exit 1
  fi
  </code></pre>