Running the commit hooks does not necessarily prevent committing with unformatted code since it only looks at the current state of the repository. Thus the following situation can occur:
- Attempt to push a commit and get an error that files are not properly formatted
- Fix the issues and commit again
- Forget to run git add and the commit hooks pass even though the committed files are unformatted
- Push unformatted code to the repository