Disclosure: I'm Bitbucket Product Manager (Stash)
Like others, this is not what is currently available in the product. The good news is that we are working on finding code at the moment. The bad news for your question is that for performance reasons (and because this is a relatively rarely used case from our research), we plan to index the top of the default branch (usually a master).
If you could describe what you are trying to achieve in more detail, I will gladly consider the alternatives.
One option: a script to execute a series of "git grep" commands in the repositories on the server (provided that you have access). You do this at your own peril and risk, although any direct operations performed against repositories on the server are not supported.
source share