Pre-commit file works perfectly in terminal, but SourceTree seems to ignore it. I use both terminal and SourceTree, as I also like the visual representation of branches and commits besides all the powerful git commands.
As of SourceTree 2.4.1, it defaults to use Embedded Git 2.8.1, but the hooksPath requires git 2.9+
So all we have to do is to go to
SourceTree -> Preferences -> Git and choose
Use System Git which lies in
/usr/bin/git As of mac Sierra 10.12.3 we have git 2.10.1
Now precommit hooks work in SourceTree