× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Search your git history

Luís Ferreira
Aug 24, 2015
<p>Git makes it super easy to search for commits that have a given string, in the commit itself. Here's how you can do it:</p> <pre><code>git log -S "query string"</code></pre> <p> </p> <p>You can also grep for a regex with:</p> <pre><code>git log -G "\w+ rest of query$"</code></pre> <p> </p> <p>Each of these commands will return the list of commits that match the query, if you wish to see the code in the commit, just add -p to any of them:</p> <pre><code>git log -S "query string" -p</code></pre> <p> </p>
comments powered by Disqus