title: Search specific git commit by commit message and exlude branches
body: <p>I am currently working on a program to filter slow db queries that are stored in a database on the command line. </p>
  
  <p>I would like to search all the commits in all the branches except the one specified and return  all the commits that match. </p>
  
  <p>My filter conditions are stored in a database (which is provided for me). </p>
  
  <p>Example: </p>
  
  <p>I have the following entry in the database:</p>
  
  <pre><code>ID key       Query
  1  ABCDEF    select * from example
  2  0ABCDE    select * from another_example
  3  1ABCDE    select * from you_get_the_picture
  </code></pre>
  
  <p>I am now interested in the queries that haven't been fixed in the code yet. So I need to search through the branches with the <strong>key</strong> as a search filter. </p>
  
  <p>If the key is found in a commit, skip and look up the next. If no match is found, print it to stdout. All the code works fine but I'm having trouble finding the correct git command. </p>
  
  <p>I have the following: </p>
  
  <pre><code>git grep 'ABCDEF' $(git rev-list ^origin/master) | xargs git show -s --format=%N%s
  </code></pre>
  
  <p>Which should return all commits containing "ABCDEF" in the commit message in all the branches except origin/master. </p>
  
  <p>However, the git command doesn't return anything which is not possible since I know that these commits are there. </p>
  
  <p>Is my git command not correct? Thanks in advance for any pointers. </p>