- Azure DevOps Server 2019 Cookbook(Second Edition)
- Tarun Arora Utkarsh Shigihalli
- 132字
- 2021-06-24 14:18:37
There's more...
The repo\.git\hooks folder is not committed into source control, so you may wonder how you share the goodness of the automated scripts you create with the team. The good news is that, from Git version 2.9, you now have the ability to map Git hooks to a folder that can be committed into source control. You could do that by simply updating the global settings configuration for your Git repository:
git config --global core.hooksPath '~/.githooks'
If you ever need to overwrite the Git hooks you have set up on the client side, you can do so by using the no-verify switch:
git commit --no-verify
You can also use PowerShell scripts in your Git hooks – refer to the walkthrough on how to implement it here: https://www.visualstudiogeeks.com/DevOps/UsingPowerShellForGitHooksWithVstsGitOnWindows.