是否有一种方法可以列出更改特定文件的所有提交?


当前回答

如果你想通过文件名而不是文件路径来查找所有的提交,使用:

git log --all -- '*.wmv'

其他回答

如果你想通过文件名而不是文件路径来查找所有的提交,使用:

git log --all -- '*.wmv'

或者(从Git 1.8.4开始),也可以只获取更改了文件特定部分的所有提交。你可以通过传递起始行和结束行号来得到它。

返回的结果将是修改该特定部分的提交列表。命令如下:

git log --pretty=short -u -L <upperLimit>,<lowerLimit>:<path_to_filename>

其中upperLimit是start_line_number, lowerLimit是ending_line_number

更多信息- https://www.techpurohit.in/list-some-useful-git-commands

Git日志路径应该做你想做的。从git日志手册页:

[--] <path>…

Show only commits that affect any of the specified paths. To prevent confusion with
options and branch names, paths may need to be prefixed with "-- " to separate them
from options or refnames.
# Shows commit history with patch
git log -p -<no_of_commits> --follow <file_name>

# Shows brief details like "1 file changed, 6 insertions(+), 1 deletion(-)"
git log --stat --follow <file_name>

参考

如果你希望看到提交中对特定文件的所有更改(而不仅仅是对文件本身的更改),你可以传递——full-diff:

git log -p --full-diff [branch] -- <path>