gpt4 book ai didi

git - 从多个存储库获取一段时间的提交历史

转载 作者:行者123 更新时间:2023-12-04 19:59:02 24 4
gpt4 key购买 nike

我需要在 Jenkins 中设置参数化作业,它将从多个存储库中检索提交历史记录,从特定日期范围内的名称中的 test* 开始(将在 jenkins 参数中设置)。
输出如下:

testQDevices
Branch development
commit MQP-1896 somenewfeatures
Branch qa
commit MQP-1836 somenewfixes

testQAPIs
Branch development
commit MQP-1996 somenewfeatures
Branch qa
commit MQP-1939 somenewfixes

你能提示我,哪个 git 命令可以检索这样或类似的输出?

UPD1。我知道我可以从 repo 中检索所有提交,从 2015 年 12 月 1 日开始,例如,使用“git log --since="2015-12-01"”。但无法弄清楚,如何检索从和到(某个时间范围)日期的所有日志。 (已解决)使用:
git log --oneline --before 2018-07-1 --after 2018-06-10

UPD2。此外,任何人都可以提示我,如何从“测试”开始从一些组织的存储库列表中检索?

最佳答案

您可以执行以下操作:

  • 调用 Github search API在您的组织内寻找匹配的 repo test名称、描述或自述文件
  • 解析 json 并仅过滤名称以 test 开头的存储库
  • 对于他们每个人从 clone_url 克隆 repo领域
  • 对于每个目录执行 git log

  • 以下示例使用 , , & :

    curl -s "https://api.github.com/search/repositories?q=org%3Agoogle%20test&per_page=100" | \
    jq -r '.items[] | select(.name | startswith("test")) | .clone_url' | \
    xargs -I{} git clone {}

    for d in */;
    do
    ( cd $d && \
    echo "repo ${d::-1}" && \
    echo "branch $(git rev-parse --abbrev-ref HEAD)" && \
    git --no-pager log --oneline --before 2018-07-1 --after 2012-06-10; )
    done

    关于git - 从多个存储库获取一段时间的提交历史,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51376361/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com