Automatically reject commit based on specific criteria

I have been looking for this for quite some time, but I have almost no experience with the subject, so I just hope someone here has met this before.

Is it possible to run any script file in SourceTree, which will check the files according to some criteria (for example, through files that check whether "StaticMethodX." Is used anywhere and does not attempt to commit if it is?

I am trying to provide the best coding standards within the team.

Any help is appreciated.

+4
source share
2 answers

You can:

  • pre-commit hook ( ), ,

  • pre-receive, , .
    git diff-index --cached --name-only, , , .

, , .

+6

npm pre- git, . sourcetree

open /Applications/SourceTree.app/Contents/MacOS/SourceTree

, sourcetree pre-commit pre-push hooks.

0

Source: https://habr.com/ru/post/1539444/


All Articles