Git pre-push hooks

前端 未结 7 1300
慢半拍i
慢半拍i 2020-11-28 02:47

I would like to run a unit-tests before every git push and if tests fails, cancel the push, but I can\'t even find pre-push hook, there is pre-commit and pre-rebase only.

7条回答
  •  囚心锁ツ
    2020-11-28 03:28

    There isn't a hook for it, because a push isn't an operation that modifies your repository.

    You can do the checks on the receiving side though, in the post-receive hook. That is where you would usually reject an incoming push. Running unit tests might be a little intensive to do in a hook, but that's up to you.

提交回复
热议问题