检测过去 x 周更新了哪些 git 个存储库?

Detect which git repositories were updated past x weeks?

我在一个目录中有一组 git 个存储库,比如 10 个。想快速浏览一下最近更新了哪些,比如最近 2 周(这当然是可配置的)。怎么做?

更新意味着已经提交。换句话说,这不是关于拉取,而是关于:哪些存储库在本地有新的提交。有什么好的方法吗?

将以下内容复制到脚本文件中,例如updateCheck.sh:

for directory in `ls -d */`; do
    pushd $directory >/dev/null
    if [ -d ".git" ]; then
        if [[ `git log -1 --all --since=` ]];
        then
          echo $directory
        fi
    fi
    popd >/dev/null
done

运行 它在包含所有 repos 的目录中,并作为参数传递给脚本你想要检查更新的时间,例如updateCheck.sh 2.weeksupdateCheck.sh 5.days