--follow适用于特定文件
git log --follow -- filename与其他解决方案的区别
请注意,其他解决方案包括git log path (不带--follow )。如果要跟踪目录中的更改,该方法很方便,但是在重命名文件时会 --follow filename (因此请使用--follow filename )。
git log path应该做你想要的。从git log man :
[--] <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.
我一直在仔细研究,所有这些答案似乎并没有真正显示出所有分支机构的所有提交。
这是我通过弄乱 gitk 编辑视图选项得出的。这向我显示了文件的所有提交,而与分支,本地,reflog 和远程无关。
gitk --all --first-parent --remotes --reflog --author-date-order -- filename它也可以和git log :
git log --all --first-parent --remotes --reflog --author-date-order -- filename