这是在git log -p中忽略文件的后续内容,也与使'git log'忽略某些路径的更改有关.
我正在使用Git 1.9.2.我正在尝试使用pathspec魔术:(exclude)来指定某些补丁不应该在输出中显示git log -p.但是,我要排除的修补程序仍显示在输出中.
这是一个重现这种情况的最小工作示例:
$ cd ~/Desktop
$ mkdir test_exclude
$ cd test_exclude
$ git init
$ mkdir testdir
$ printf "my first cpp file\n" > testdir/test1.cpp
$ printf "my first xml file\n" > testdir/test2.xml
$ git add testdir/
$ git commit -m "added two test files"
Run Code Online (Sandbox Code Playgroud)
现在我想显示我的历史记录中的所有补丁,期望与文件testdir夹中的XML文件相对应的补丁.因此,按照VonC的回答,我跑了
$ git log --patch -- . ":(exclude)testdir/*.xml"
Run Code Online (Sandbox Code Playgroud)
但我的testdir/test2.xml文件的补丁仍显示在输出中:
commit 37767da1ad4ad5a5c902dfa0c9b95351e8a3b0d9
Author: xxxxxxxxxxxxxxxxxxxxxxxxx
Date: …Run Code Online (Sandbox Code Playgroud)