あなたが探している答えは だと思いますgit --no-pager log --pretty="%H" -G"SOME CHANGE" -- myfile.extension
。
最初は思いgit log -S
ましたが、追加/削除のみをカバーしています。 git log -G
おそらくあなたが望むものに近いでしょう。-S
ここでは、との違いを確認できます-G
。完全なコミット履歴も含めて、カバーされていないものを確認できるようにします。本文で行ったことの説明については、コミット メッセージを参照してください。
# git --no-pager log --oneline -S"SOME CHANGE"
12e24ed Remove text
9427ffc Add the text
# git --no-pager log --oneline -G"SOME CHANGE"
12e24ed Remove text
6a33653 Change other text on same line
ac09bbb Append other text to same line
484b447 Move the text two lines down
9427ffc Add the text
# git --no-pager log --oneline
12e24ed Remove text
9c7f7d5 Change text on adjacent line
6a33653 Change other text on same line
ac09bbb Append other text to same line
484b447 Move the text two lines down
377936f Add other text on adjacent line
9427ffc Add the text
1929648 Initial commit
ハッシュだけで取得するには:
# git --no-pager log --pretty="%H" -G"SOME CHANGE"
12e24ed749e499bc2d8920c5d8a3ca98a6422e3f
6a336532210ca85dea86968c34cef516345b8ab4
ac09bbb5c95bbea65e7c99c730653d27f90397f4
484b4478e4cb16c839dac558f3e958683b428a64
9427ffc7dd60a3cfb1d9880083e6262faea0eefb