git 推送源的 TFS 远程消息

TFS remote messages for git push origin

TL;DR:我正在寻找一种获取 TFS git 存储库的方法,以提供有关如何在 git 推送源之后创建拉取请求的说明。我认为最好的解决方案是服务器端挂钩,如果它在 TFS 2018 中受支持的话。


我知道如果我 git 将 origin new_branch 推送到 github 存储库,我可以得到一个响应,上面写着一些东西像这样:

git push -u origin new_branch
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Writing objects: 100% (2/2), 500 bytes | 500.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Remote: Create a pull request for ‘new_branch’ on GitHub by visiting:
Remote:   http://github.com/example/Demo/pull/new/new_branch
Remote:
 * [new branch]         new_branch -> new_branch

(注意以“Remote:”开头的三行)

我正在将一些代码迁移到由 Microsoft TFS 的本地实例托管的 git 存储库。目前,当我 运行 a git 将 origin new_branch 推送到 TFS 存储库时,我得到如下信息:

Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 217 bytes | 1024 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Analyzing objects... (2/2) (53 ms)
remote: Storing packfile... done (47 ms)
remote: Storing index... done (45 ms)
To https://tfsserver.jallc.lan/DefaultCollection/TSG/_git/reponame
c4512bd..80227e1  branchname -> branchname

这个 git 存储库和几个类似的存储库将被一群刚接触源代码控制的系统管理员使用,所以我很想找到一种方法来提醒他们如何提交拉取请求。

我认为以“Remote:”开头的三个 github 线来自 post-receive hook,即 运行 [=49] =]-在/.git/hooks.

中接收文件

我已经让这个(客户端)预推送脚本开始工作:

echo "hi" 
echo "Don't forget to generate a pull request.  You can do so by navigating to:"
echo "/pullrequestcreate?targetRef=master&sourceRef=<your branch> and following the prompts."

但是在我的客户端上修改 post-接收和更新脚本没有任何效果。我假设它们需要在服务器上进行修改,但不知道在 TFS 服务器上的何处可以找到 repo 的 .git/hooks 文件夹。无论如何,客户端总比没有好。

如有任何关于如何让 post-receive 脚本在 TFS 服务器上触发的想法,我们将不胜感激。

非常感谢!

TFS 2018 不支持 git 服务器端挂钩。

所以你的好主意是不可能的。

我建议open a feature request about it like there is about pre-receive hook.