Enable Client-side Hooks When Committing Code to a Git Source Control Instance
To be exact, VS2017 no longer uses libgit2, rather it uses git.exe directly, so git hooks are now supported.
This has been implemented in Visual Studio 2017:
Andrei Dragusanu commented
Seriously? Even Visual Studio Code has this...
Niels Anonymous commented
Unbelievable that this is still open after such a time :-( Even Egit has support for it.
We have some super important verifications in our pre-push hook that prevent possible cross-platform build breaks, this is essential!
This is very sad, as it renders basically all IDEs (at least all of them using libgit2) unable to integrate with commit hooks workflows.
The point of git commit hooks is that they are respected, not that they may ignored depending on the tool you use to interact with git.
Jon Hilton commented
Looking at the latest comments on this thread https://github.com/libgit2/libgit2/issues/964 it seems that this will not be added to the libgit2 library and would need to be implemented by the VS team...
The integration becomes useless for me then. We use CI builds and we need to notify Jenkins after each commit. :(
Quinn Bailey commented
Apparently the core problem is that libgit2 does not support hooks and since the VS Git plugin uses this lib instead of the git command line (MsysGit), it wont be added to VS until libgit2 supports it (if ever). See https://github.com/libgit2/libgit2/issues/964
Virgil Schleich commented
This is a great suggestion. The hooks are part of the standard Git implementation. I don't know why MS did not implement them.
We are using a non-MS code review product that uses the post-commit hook to catch changes. Without VS executing these standard hooks, the VS integration is pretty much useless to us.