开发者

How to get latest revisions for a file list in git?

I would like to get revision numbers for several files (at once if possible), for each file I want to know in which revision it changed last.

Like this:

a.txt - a85fb1,
b.txt - 84a146,
c开发者_运维技巧.txt - a85fb1,
...

Thx!


This will work for one file at a time:

git log --format=%H -1 HEAD a.txt

This would work for multiple files "at once":

for i in a.txt b.txt c.txt; do paste <(echo $i) <(git log --format=%H -1 HEAD $i); done

This might work for all files in your repo:

for i in $(git ls-files); do paste <(echo $i) <(git log --format=%H -1 HEAD $i); done
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜