Can I add a "Precommit hook" to TFS?

We want every user to click on our git repository to run "grunt" before this is done. We do this by pre-clicking in .git/hooks/pre-push and writing npm install and grunt in this file.

We also have a TFS repository. I am looking for similar logic to be used here. It is clear that we want someone to try to check something. This only launches PowerShell and runs locally npm install and grunt .

We don’t want TFS to do anything else (run the build, run the tests, etc. (all this is done in the grunt task)).

Is it possible? Does anyone know how?

+7
git tfs pre-commit-hook gruntjs pre-commit
source share
1 answer

TFS has nothing to do with what you do locally. You can add as many relays before committing and move them to TFS. TFS will happily save these scripts. And when you use a client that supports them, this client will pre-commit them.

But if you expect Visual Studio to launch these hooks before committing, you're probably out of luck. When connecting to Git, there is no registration policy support for Visual Studio. As far as I know, no other Git client based on LibGit2 yet.

You can configure the branch policy associated with the CI assembly by efficiently performing grunt tasks on the build server, but I understand that this is not what you want ..

In the LibGit2 problem section, there is some background that Visual Studio uses to implement its Git features . And this corresponding custom voice element for Visual Studio . As well as a discussion of the GitHub client for Windows , which uses the same base library.

+1
source share

All Articles