From 527bfde9f3008b7e422c0f5b361f9bebe4e438cc Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Mon, 16 Sep 2024 17:24:46 +0200 Subject: Add notes how to search git history. --- doc/note/git/git.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/note/git/git.txt b/doc/note/git/git.txt index d0325a1..2dcf2a1 100644 --- a/doc/note/git/git.txt +++ b/doc/note/git/git.txt @@ -38,6 +38,19 @@ twice with colon in between): git log --follow -- path/to/file +## History search for file contents + +Commit message contains: git log --grep foo + + git log -S foo File contents "foo" (literal) num occur has changed: + git log --pickaxe-regex foo File contents "foo" (regex) num occur has changed: + git log -G foo Diff contains "foo" (regex): + +For "-G" add "--patch" to get diff in place of ref. + +[src](https://stackoverflow.com/a/1340245/4415884) + + ## Auto-destroy code-format && REMOTENAME=upstream \ -- cgit v1.1