Microsoft Azure DevOps Repo: search for text/code in specific branch

Viewed 5137

I'm embarrassed to ask what should be a simple thing to figure out....

However, when I'm viewing a specific branch in an Azure DevOps repository online (e.g., when reviewing a PR), I can't figure out how to perform a search of that branch's code.

I see a global search textbox at the top, as follows: enter image description here

And I see a textbox for searching the branch for file/folder names, as follows:

enter image description here

But what I don't see is a textbox for searching the contents of the files in that branch....e.g. for finding occurrences of someFunction() or somePropertyName or whatever inside the code files for that particular branch.

Did Microsoft really omit this functionality? Or am I missing something? How do we perform such a search?

3 Answers

First, input content in the global search textbox at the top and search:

enter image description here

Now, you can select your repo and branch the dropdown list: enter image description here

By default, code search only applies to your default branch. You may add up to 5 more here: enter image description here Please notice that when a new branch is configured for search via “include/exclude searchable branches”, the branch list of search is not immediately populated with the newly configured branch. This happens because it takes some time to on-board a new branch and make is searchable. It takes up to 12 hours to fully initialize the branch.

You can also refer to this document about search your code.

what they aren't telling you (and I just went through this today) is that you have to have a "successful" search in order to get the Branch: filter to appear & be selectable. "Failed" searches give you all the filter dropdowns but you cannot change them.

In fairness you'd just be better off actually Doing a Pull and using git to search the code then ..

Related