title: How to search through all Git and Mercurial commits in the repository for a certain string?
body: <p>I have a Git repository with few branches and dangling commits. I would like to search all such commits in repository for a specific string.</p>
  
  <p>I know how to get a log of all commits in history, but these don't include branches or dangling blobs, just HEAD's history. I want to get them all, to find a specific commit that got misplaced.</p>
  
  <p>I would also like to know how to do this in Mercurial, as I'm considering the switch.</p>