title: search both history log and files on git, with termux and regexp
body: <p>tried every answer from similar questions:</p>
  <p><a href="https://stackoverflow.com/questions/1337320/how-to-grep-git-commit-diffs-or-contents-for-a-certain-word/274502">How to grep Git commit diffs or contents for a certain word?</a></p>
  <p><a href="https://stackoverflow.com/questions/4468361/search-all-of-git-history-for-a-string/274502">Search all of Git history for a string?</a></p>
  <p><a href="https://stackoverflow.com/questions/2928584/how-to-grep-search-committed-code-in-the-git-history/274502">How to grep (search) committed code in the Git history</a></p>
  <p>none worked!</p>
  <p>would it even be possible to search using <a href="https://beyondgrep.com/feature-comparison/" rel="nofollow noreferrer">anything other than <code>git</code> itself</a>?</p>
  <p>repository tested: <a href="http://cregox.net" rel="nofollow noreferrer">http://cregox.net</a></p>
  <h1>scenario</h1>
  <p>picture hundreds of markdown files, a dozens of which will have something like this:</p>
  <pre><code>---
  title: lorem ipsum
  description: foo, or not foo, it's not even a question
  bar: false
  </code></pre>
  <p>(in practice, instead of <code>foo</code> it was <code>checklist</code> and instead of <code>bar</code> i wanted <code>published</code>)</p>
  <h1>expected</h1>
  <pre><code>ag &quot;foo[\s\S]*bar:\ &quot;
  </code></pre>
  <p>will search all files with 1 <code>foo</code> that happens before the first <code>bar: </code> if they both exist.</p>
  <p>all i needed was <strong>that</strong>, applied to git history.</p>
  <p>that's it.</p>
  <p>but...</p>
  <h1>reality</h1>
  <pre><code>git log -G &quot;foo[\s\S]*bar:\ &quot;
  </code></pre>
  <p>instead of silversearcher-ag doesn't even work because of <code>\s</code>.</p>
  <p>i've tried <a href="https://stackoverflow.com/a/45981809/274502">many</a> variations of regexp, couldn't find any single one that would work!</p>
  <p>so that's something that i'll want to fix at some point, but meanwhile i also tried other alternatives...</p>
  <pre><code>git log -p -S foo
  </code></pre>
  <p>should bring something similar to <code>rg foo</code>, but doesn't come even close to be readable and it's way too verbose.</p>
  <pre><code>git log --name-status --oneline -S foo
  </code></pre>
  <p><a href="https://gist.github.com/lyoshenka/8251914" rel="nofollow noreferrer">this</a> was the closest i could get to the expected results... but it's still too cumbersome.</p>
  <p>i give up digging for now.</p>