You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何快速获取ADO Wiki Git仓库各文件的提交作者与更新日期?

快速获取Git仓库中所有文件的提交作者及日期信息

我有一个包含大量文档的ADO Wiki Git仓库,需要获取仓库内每个文档的提交作者和最后更新日期。目前我对每个文件单独执行以下命令:

git log -1 --pretty=format:%ci, %cn -- <file path>

但这种方式速度极慢,耗时很久才能完成,求更快的实现方法。


更新说明

我修改了已采纳的方案,使其可以获取文件的最早提交日期(创建日期)及所有提交作者,对应的Bash脚本如下:

#!/bin/bash

declare -A seen_latest seen_earliest authors

while read -r line ; do
    if [[ $line = /* ]] ; then
        hash=${line%% *}
        date=${line#* }
        date=${date:0:25}
        committer=${line#* }
        committer=${committer:26}
    elif [[ $line && -z ${seen_latest[$line]} ]] ; then
        seen_latest[$line]="$date|$committer"
    fi
    if [[ $line ]] ; then
        if [[ -z ${authors[$line]} ]] ; then
            authors[$line]="$committer"
        elif [[ ! "${authors[$line]}" =~ "$committer" ]] ; then
            authors[$line]="${authors[$line]}:$committer" # 可自行更换分隔符
        fi
        seen_earliest[$line]="$date|$committer"
    fi
done < <(git log --format='/%H %ci %cn' --name-only)

find -name .git -prune -or -print | while read f ; do
    f=${f#./}
    printf '%s|%s|%s|%s\n' "$f" "${seen_latest[$f]}" "${seen_earliest[$f]}" "${authors[$f]}"
done

内容的提问来源于Stack Exchange,提问作者Morez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 04:27:24