2013-08-05 34 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

相關問題