Prevent pushes to git containing tabs in certain files (e.g. *.cpp, *.h, CMakeLists.txt)

前端 未结 3 850
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-02 11:47

I\'d like my remote repository to refuse any pushes that contains a file that contains a tab, but only if the file belongs in a certain class (based on the filename). Is that po

3条回答
  •  心在旅途
    2021-02-02 12:29

    You could setup a pre-push hook, but this is not really in the spirit of the git publication mechanism.

    I would rather go with:

    • a pre-commit hook, preventing any commit with the wrong content
    • or a filter driver that you can easily associate with the right types of file, and which can fix or report any improper content.

提交回复
热议问题