如何在合并提交上执行 git show 时指定路径
How to specify path when doing git show on a merge commit
我有一个合并提交,我可以使用 git show -m
显示它的全部内容。但是,如果我只想显示子文件夹或路径的更改,我该怎么做?我尝试执行 git show -m -- app/
但它没有显示任何内容,即使 git show --stat
表明存储库的那部分正在进行合并。
您可以使用 --relative
:
git show -m --relative=app/
但它会显示相对于路径中提供的目录的路径:
--relative[=<path>]
When run from a subdirectory of the project, it can be told to exclude changes outside the directory and show pathnames relative to it with this option. When you are not in a subdirectory (e.g. in a bare repository), you can name which subdirectory to make the output relative to by giving a <path>
as an argument.
我有一个合并提交,我可以使用 git show -m
显示它的全部内容。但是,如果我只想显示子文件夹或路径的更改,我该怎么做?我尝试执行 git show -m -- app/
但它没有显示任何内容,即使 git show --stat
表明存储库的那部分正在进行合并。
您可以使用 --relative
:
git show -m --relative=app/
但它会显示相对于路径中提供的目录的路径:
--relative[=<path>]
When run from a subdirectory of the project, it can be told to exclude changes outside the directory and show pathnames relative to it with this option. When you are not in a subdirectory (e.g. in a bare repository), you can name which subdirectory to make the output relative to by giving a
<path>
as an argument.