Git:如何确定添加或删除给定标识符的文件名?

Cal*_*laf 5 git

我发现.razmatazz在HTML文件中使用了某个CSS类,但是这个标识符不在任何现有的CSS文件中.这解释了不正确的演示,我已经"踢了一段时间".

我能找到的所有 提交中,该标识符是由运行的是添加或删除

> git log -S razmatazz --source --all
847d9d8 Thu Jun 25 10:05:07 2018 Joe C helpful commit message.
9384843 Wed May 20 14:10:34 2018 Joe C ever more helpful commit message.
2093483 Mon Apr 15 11:15:51 2018 Joe C yet another great message.
Run Code Online (Sandbox Code Playgroud)

但同时我一直在合并/取消合并/重命名我的CSS文件,因此我不知道CSS文件名.

如何确定添加或删除给定标识符的文件名?

由于"pickaxe"git选项没有说明是否添加或删除了标识符,我会尝试找到的哈希值和它们的前辈

git show 847d9d8:/path/to/file
git show 847d9d8^:/path/to/file
git show 9384843:/path/to/file
git show 9384843^:/path/to/file
git show 2093483:/path/to/file
git show 2093483^:/path/to/file
Run Code Online (Sandbox Code Playgroud)

获取丢失的定义.

LeG*_*GEC 1

-S或者-G实际上可以与其他选项结合使用:

  • --name-only并且--name-status只会列出选择了所述模式的文件,

  • -p|--patch只会显示所述文件的差异(尽管这些文件的完整差异,但它不会将差异限制为仅影响-G / -S搜索条件的块)


所以:根据您的需要,将-p或添加--name-status到您的git log -S razmattaz命令中。