Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To search for commit <em>content</em> (i.e., actual lines of source, as opposed to commit messages and the like), what you need to do is:</p> <pre><code>git grep &lt;regexp&gt; $(git rev-list --all) </code></pre> <p><strong>Updates</strong>: <code>git rev-list --all | xargs git grep expression</code> will work if you run into an "Argument list too long" error</p> <p>If you want to limit the search to some subtree (for instance "lib/util") you will need to pass that to the <code>rev-list</code> subcommand and <code>grep</code> as well:</p> <pre><code>git grep &lt;regexp&gt; $(git rev-list --all -- lib/util) -- lib/util </code></pre> <p>This will grep through all your commit text for regexp.</p> <p>The reason for passing the path in both commands is because <code>rev-list</code> will return the revisions list where all the changes to <code>lib/util</code> happened, but also you need to pass to <code>grep</code> so that it will only search on <code>lib/util</code>.</p> <p>Just imagine the following scenario: <code>grep</code> might find the same <code>&lt;regexp&gt;</code> on other files which are contained in the same revision returned by <code>rev-list</code> (even if there was no change to that file on that revision).</p> <p>Here are some other useful ways of searching your source:</p> <p>Search working tree for text matching regular expression regexp:</p> <pre><code>git grep &lt;regexp&gt; </code></pre> <p>Search working tree for lines of text matching regular expression regexp1 or regexp2:</p> <pre><code>git grep -e &lt;regexp1&gt; [--or] -e &lt;regexp2&gt; </code></pre> <p>Search working tree for lines of text matching regular expression regexp1 and regexp2, reporting file paths only:</p> <pre><code>git grep -e &lt;regexp1&gt; --and -e &lt;regexp2&gt; </code></pre> <p>Search working tree for files that have lines of text matching regular expression regexp1 and lines of text matching regular expression regexp2:</p> <pre><code>git grep -l --all-match -e &lt;regexp1&gt; -e &lt;regexp2&gt; </code></pre> <p>Search working tree for changed lines of text matching pattern:</p> <pre><code>git diff --unified=0 | grep &lt;pattern&gt; </code></pre> <p>Search all revisions for text matching regular expression regexp:</p> <pre><code>git grep &lt;regexp&gt; $(git rev-list --all) </code></pre> <p>Search all revisions between rev1 and rev2 for text matching regular expression regexp:</p> <pre><code>git grep &lt;regexp&gt; $(git rev-list &lt;rev1&gt;..&lt;rev2&gt;) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload