[英]How can I use Git to see in which commits a file was renamed?
I don't want to see the whole history or diffs (so git log --follow filename
is not I'm looking for).我不想看到整个历史或差异(所以git log --follow filename
不是我要找的)。
I want to find out the commit ids in which a file might have been renamed, in order to figure out the date & time of the changes.我想找出文件可能已重命名的提交 ID,以便找出更改的日期和时间。
Can git do this? git可以做到吗? My Google Fu is weak, I couldn't find anything about this.我的 Google Fu 很弱,我找不到任何相关信息。
Try尝试
git log --name-status --follow --diff-filter=R -- new_filename
--diff-filter=R
matches commits which have renamed files. --diff-filter=R
匹配重命名文件的提交。 --follow
and the new filename are also necessary. --follow
和新文件名也是必需的。 Without --follow
, the commit that has the renaming is excluded.如果没有--follow
,则排除具有重命名的提交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.