问题描述
TL;DR:我正在寻找一种方法来获取 TFS git 存储库,以提供有关如何在 git push 源之后创建拉取请求的说明。如果 TFS 2018 支持,我认为最好的解决方案是服务器端挂钩。
我知道,如果我 git push 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 存储库。目前,当我将 git push 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),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 repo 和几个类似的将被一群不熟悉源代码控制的系统管理员使用,所以我很想找到一种方法来提醒他们如何提交拉取请求。
我相信以“Remote:”开头的三个 github 行来自一个“post-receive hook”,它由 /.git/hooks 中的 post-receive 文件运行。
我已经让这个(客户端)预推送脚本工作了:
echo "hi"
echo "Don't forget to generate a pull request. You can do so by navigating to:"
echo "$2/pullrequestcreate?targetRef=master&sourceRef=<your branch> and following the prompts."
但是在我的客户端上修改 post-receive 和 update 脚本没有任何效果。我假设它们需要在服务器上进行修改,但不知道在 TFS 服务器上在哪里可以找到 repo 的 .git/hooks 文件夹。无论如何,客户端总比没有好。
关于如何让接收后脚本在 TFS 服务器上触发的任何想法将不胜感激。
非常感谢!