Run testng test in Git pre-commit hook
问题 How would I write a bash script that will run as a git pre-commit hook to fail if a specific testng test fails? I currently run my testng tests through maven surefire like this: mvn clean test -Dtest="MyTestName" 回答1: If the pre-commit hook returns non-zero, then the commit is aborted before it even starts. In a script for a bourne style shell (e.g. sh, ksh, zsh, bash, etc.), by default the return value of the last command run is the return value of the script. As I understand it mvn clean