Check-In Policy in Git VSTS

1.1k Views Asked by At

How can i set check-in policy for git in VSTS as i can see only branch policies available.Is there any plugin available for check-in policy in Git as i want to apply below check-in policy before developers check-in any code

•   Builds: Requires that the last build was successful before a check-in.
•   Code Analysis: Requires that code analysis is run before check-in.
•   Work Items: Requires that one or more work-items to be associated with the check-in.
•   Comments: Requires that a standard comment any code check-in
1

There are 1 best solutions below

2
On

Regarding Git with VSTS, there is only branch policy and it is used for Pull Request instead of check-in/commit/push (Merge code after complete pull request). You can require the successful build, work item association and so on.

Regarding check-in/commit policy, you need to do it with git hook (check comment, work item (#ID in comment, file (e.g. Code analysis file) in the code).

More information, you can refer to Customizing Git - An Example Git-Enforced Policy.

A related thread: Setup a git commit message policy