将一个git存储库的问题链接到另一存储库的提交 [英] Linking Issues of one git repository to commits of another repository

查看:76
本文介绍了将一个git存储库的问题链接到另一存储库的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个项目"project-A",和"Project-B".该问题在"A项目"中被报告.但实际的开发工作仍在"project-B"中进行.

I have two projects "project-A" and "project-B". The issues are being reported in "project-A" but the actual development is going on in "project-B".

引用"project-A"在每个提交评论中都是具有挑战性的.我正在寻找一种更好的选择,以将"project-A"问题联系起来.链接到项目-B"代码提交.一个简单的问题是开发人员是否提交带有注释#23 fixed"的注释.在项目B"中,它应该在项目A的相关问题评论历史记录"中可见.

Referring "project-A" in every commit comment is challenging. I am exploring for a better option to link the issues of "project-A" to be linked to "project-B" code commits. A simple ask is if the developer commits with a comment "#23 fixed" in 'project-B', it should be visible in 'project-A's relevant issue comment history.

推荐答案

1.转换git commit消息:

从您的工作区

$ cd myrepo
$ vi .git/hooks/commit-msg

请注意,这是一个客户端挂钩.现在向其中添加以下内容

Note that this is a client side hook. Now add the following content to it

#!/bin/sh
projecta_issues_link="https:\/\/github.com\/git\/git\/issues\/"

message=`cat $1 | sed "s/projecta/${projecta_issues_link}/g"`
echo ${message} > $1
exit 0

然后更改任何文件,并使用以下消息提交它:

Then make a change to any file, and commit it with the following message:

git commit -m "This fixes projecta#1234"

您的提交消息应立即转换为链接.

Your commit message should be transformed to a link now.

2.在所有存储库上应用客户端挂钩:

此处有一个写得很好的答案.

There's a really well-written answer to that here.

这篇关于将一个git存储库的问题链接到另一存储库的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆