Add server-side git hooks
Please add server-side git hooks. Github has this feature and it is extremely useful.
We have added the Pull Request status API: https://docs.microsoft.com/en-us/vsts/git/branch-policies#require-approval-from-external-services
This API allows you to block commits from ending up in shipping branches. With the push (https://docs.microsoft.com/en-us/vsts/service-hooks/events#git.push) and PR (https://docs.microsoft.com/en-us/vsts/service-hooks/events#git.pullrequest.created) service hooks, we now offer a full, asynchronous way to plug into the PR pipeline.
We are considering adding native pre-receive hooks to reject certain commits on push. If those are important to you, or you want to see particular ones, please vote/comment on them here: https://visualstudio.uservoice.com/forums/330519/suggestions/32584894
S Olson commented
Is there an update on this?
David Jansen commented
Hi, I've just noticed that Git events are in VSTS, but not yet in TFS 2018 RC1. Any update on when these events will be available? Are we also able to get events on security changes? E.g. User permissions change?
This appears to be implemented and documented here:
However, the events related to Git are pretty minimal, and do not appear to allow rejection of the action.
The commit message hook is necessary to aid in change tracking. All our DEV branches are prefixed with a ticket #. When all our commit messages are also prefixed with the same ticket # (some developers forget) it is easy to visualize all commits for that ticket. The hook could be used to prefix the ticket # of the branch to the commit.
What summer would that be? 2017? 2018? Later?
Charlie Davison commented
Would appreciate an update on this!
Jason Mowbray commented
I'd also like an update please!
James Lucktaylor commented
Would love an update on this also, as I need some server-side hooks to protect my devs from themselves!
It would be really interesting to hear something about this. several development team in our company are not using VS as the main git client only because of the hooks issue.
Mike Lombardi commented
Has there been further movement on this? I'd love to be able to run tasks tied to different git hooks.
Keith Hill commented
Support for pull requests is cool but how about supporting a hook that prevents empty commit messages? Or does something like this already exist? This is a feature we had with TFVC and TFPT and miss it with TFS Git.
Eric Swanson commented
This seems like as straight-forward a feature to support as it does "git clone". Integration is key and requiring integrations to use a custom Microsoft API seems less than ideal, especially with how many competitors offer solutions.
Tom Caflisch commented
Any update on this? Is this available on TFS 2015?
Thomas Piart commented
We also would need this to be able to have build with submodules in visual studio online
This can be done, though not in the standard git way:
There is still an issue, though, in regards to information being sent to the git client. See http://social.msdn.microsoft.com/Forums/vstudio/en-US/5cf99831-975c-495e-a77f-8ef0eaba6c62/return-string-for-processevent-of-a-git-pushnotification
To vote up the fix to the above issue, go here:
Derek Gray commented
This is a must-have; we would like to build using Jenkins like the rest of our department, and polling is inefficient
This is a mandatory feature for us; we cannot integrate with external tools without it - which means we cannot replace GIT with TFS/GIT.
This would be extremely useful! Hooks are great for integrating with an arbitrary number of external tools.
Rome Li commented
this is mandatory because we need to use git submodule on the build server
This could be the answer to lack of check-in policy