git:获取沿着一个特定文件修改的文件列表 [英] git: get the list of files that have been modified along one specific file
问题描述
我想检查哪些文件已经同时修改为一个特定的文件。具体来说,我想获取这个特定文件的历史记录,并且对于这个历史的每一次提交,我想知道哪些文件受到影响。
当我执行 git log --name-only
,我得到了提交的完整历史记录,以及为每次提交都修改过的文件列表。
现在,如果我执行 git log< file>
,我会得到涉及这个特定文件的提交历史记录。
git log --name-only< file>
,但不包括每个提交修改的文件的完整列表。相反,它只显示< file>
,这对老实说毫无用处。
有什么办法让这个命令包含所有文件吗?
您可以管理这两个命令。 p>
$ git log --format =%h< file-name> | xargs git show --name-only
这里:
git log --format =%h:选择提交文件被更改的提交地址
xargs git show --name-only :将选定的提交作为参数并显示完整更改的文件名。
I'd like to check which files have been modified at the same time as one specific file. Specifically, I want to get the history of this specific file, and for each commit of this history I want to know which files were affected.
When I do git log --name-only
, I get the full history of commits, as well as a list of files that have been modified, for each commit.
Now if I do git log <file>
, I get the history of the commits that involved this specific file.
git log --name-only <file>
, however, do not include the full list of files modified by each commits. Instead it only shows me <file>
, which is quite useless to be honest.
Is there any way to make this command include all files?
You can pipeline the two commands.
$ git log --format="%h" <file-name> | xargs git show --name-only
Here:
git log --format="%h" : select the commit-sha where the given file is changed
xargs git show --name-only: takes the selected commits as args and show the full changed file names.
这篇关于git:获取沿着一个特定文件修改的文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!