2013-08-05 36 views
2

我如何找到发生指定更改的提交?在这种情况下,既不知道确切的文件名,也不知道确切的布料数量。它基本上是一个原始搜索。 I.E.我搜索其中一行包含从“之前”到“之后”更改的提交。如何查找发生指定更改的提交?

即。提交历史如下:

  • 提交甲(基)

    The line without change 
        The text *before* the change 
        Another line without relevant change, before 
    
  • 提交B:

    The line without change 
    - The text *before* the change 
    + The text *after* the change 
        Another line without relevant change, before 
    
  • 提交C:

    The line without change 
        The line of code *after* the change 
    - Another line without relevant change, before 
    + Another line without a relevant change 
    

因此,我只是想要提交B的散列。我基本上需要所有文件中的所有更改。

+0

只是为了我自己的理解,应该在你的'Commit B'中不交换 -/+吗? – Chris

+0

哎呀,是的,应该交换 – helt

+0

好,我真的很担心我是厚= D – Chris

回答

4

使用git log -G<search pattern>。欲了解更多信息,请参阅this article的第二部分。

+1

-G为正则表达式,或-S为固定字符串 –

+0

这种方式,但它产生了很多误报。我还没有找到一种方法来抑制那些不包含“之后”变更的提交。 – helt

相关问题