git 列出给定文件的所有提交(跨所有分支)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7466709/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 11:52:24  来源:igfitidea点击:

List all commits (across all branches) for a given file

git

提问by Saurabh Nanda

This question is closely related to List all commits for a specific filehowever it is different. I want to find out which commits, across all branches, had modified a given file.

这个问题与列出特定文件的所有提交密切相关,但它是不同的。我想找出所有分支中哪些提交修改了给定文件。

To make it more complex, the given file may or may not be in the working tree.

为了使它更复杂,给定的文件可能在也可能不在工作树中。

采纳答案by Kit Ho

You can use gitk

你可以使用 gitk

gitk --all <path to file> (you need to install gitk)

gitk --all <path to file> (you need to install gitk)

e.g.

例如

gitk --all -- /home/kit.ho/project/abc.txt

gitk --all -- /home/kit.ho/project/abc.txt

回答by manojlds

Try this:

尝试这个:

git log --all -- path

回答by DrumM

Command line

命令行

I would highly recommend to add the graph option with git log:

我强烈建议使用 git log 添加图形选项:

git log --graph --all -- <filename>

git log --graph --all -- <filename>

git log --graph --all -- <文件名>

Gui

Gitk is an pretty old tool and not always installed, I recommend a different free tool like e.g. SourceTree:

Gitk 是一个很老的工具,并不总是安装,我推荐一个不同的免费工具,比如 SourceTree:

SourceTree

源树