我能获得与GitHub特定文件/目录路径相关的所有拉取请求列表吗?

10

是否有可能获取涉及给定目录下任何文件的拉取请求列表?

前几天,我不得不浏览过去几个月的数十个拉取请求,并收集所有涉及到感兴趣路径下任何文件的拉取请求。

我试图在GitHub上使用文件路径搜索PR,但似乎文件路径没有被索引。深入探究后,我并没有找到解决拉取请求中文件搜索的方法,这有点令人惊讶。最终,我不得不查看各个目录的提交历史并收集相关的PR,但这相当繁琐。

GitHub是否支持通过受影响的文件总结PR?也许这是API可以实现的功能?


https://dev59.com/RmQm5IYBdhLWcg3wrAmY#26870440 - Grzegorz Górkiewicz
2个回答

2
git log --merges --first-parent -- <file>

该命令将展示与特定文件有关的合并更改的提交记录。由于您使用PR来合并文件,因此这可能已经足够。

然而,如果情况不是这样的,且您在主线上有其他不是PR的合并提交,您可能需要使用--author=<pattern>--committer=<pattern>--grep=<pattern>标志来进一步过滤输出:

   --author=<pattern>, --committer=<pattern>
       Limit the commits output to ones with author/committer header lines that match
       the specified pattern (regular expression). With more than one
       --author=<pattern>, commits whose author matches any of the given patterns are
       chosen (similarly for multiple --committer=<pattern>).

   --grep=<pattern>
       Limit the commits output to ones with log message that matches the specified
       pattern (regular expression). With more than one --grep=<pattern>, commits whose
       message matches any of the given patterns are chosen (but see --all-match).

       When --show-notes is in effect, the message from the notes is matched as if it
       were part of the log message.

这是命令行git,不是我认为针对GitHub网页界面特定问题的理想答案。尽管如此,还是谢谢您。 - Graham Perrin

0
我刚刚有同样的问题,你可以在PR过滤器中搜索路径。

Github PR


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接