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

The*_*per 10 git github pull-request

是否可以获取已触及给定目录下任何文件的拉取请求列表?

有一天,我不得不费力地浏览过去几个月的数十个拉取请求,并收集所有触及特定感兴趣路径下任何文件的拉取请求。

我尝试使用 GitHub 上的文件路径搜索 PR,但文件路径似乎没有索引。进一步探索后,我确实找不到在拉取请求中进行文件搜索的解决方案,这有点令人惊讶。我最终不得不遍历各个目录的提交历史并收集相关的 PR,但这相当乏味。

是否支持按 GitHub 中受影响的文件汇总 PR?也许这就是 API 的能力?

Poc*_*ets 2

git log --merges --first-parent -- <file>
Run Code Online (Sandbox Code Playgroud)

将向您显示合并到特定文件更改中的提交。由于您使用 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.
Run Code Online (Sandbox Code Playgroud)