问题描述
:我想要列出所有在两次提交之间已更改的文件,即使它们现在相同(即,已更改,然后再更改)。
A riff on git: show all changed files between two commits: I want a listing of all files that have been changed between two commits, even if they are now the same (ie, changed and then changed back).
推荐答案
这是我能想到的最好的:
This is the best I could come up with:
git log --name-only --pretty=oneline --full-index HEAD^^..HEAD | grep -vE '^[0-9a-f]{40} ' | sort | uniq
用您想要比较的提交替换HEAD ^^和HEAD。
Replace HEAD^^ and HEAD with the commits you want to compare.
我尝试使用 git log
和 - 仅限名称
列出所有文件在指定的提交之间的每个提交。 - pretty = oneline
使文件列表上方的部分仅包含提交SHA和消息标题。 - 完整索引
使SHA成为完整的40个字符。 grep
过滤掉任何看起来像SHA和空格的东西。除非您的文件以SHA开头,后跟空格,否则结果应该是准确的。
My attempt uses git log
with --name-only
to list all files of each commit between the specified ones. --pretty=oneline
makes the part above the file listing consist only of the commit SHA and message title. --full-index
makes the SHA be the full 40 characters. grep
filters out anything looking like a SHA followed by a space. Unless you have files beginning with a SHA followed by a space, the result should be accurate.
这篇关于git:显示在两次提交之间更改的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!