Git: Run through a filter before commiting/pushing?
问题 Is there a way to run the changed files through a filter before doing the commit? I wish to make sure the files follows the coding standards for the project. I would also like to compile and run some test before the commit/push actually takes place, so I know everything in the repo actually works. 回答1: Pre-commit hooks. Read up on git hooks. The Git Book has an example of how to write a Ruby script to run RSpec tests, for instance. You just save the executable as .git/hooks/pre-commit - using