In this article, we are going to learn how to perform a search in different branches quickly using the Azure DevOps marketplace extension called Code Search.
One of the most common requirements is to perform search in your Azure DevOps git repository. For ex: Let’s say, you would like search for a Class name in your git repo, you can type the class name in the Search bar available in the Azure DevOps portal as shown below.
By default, as shown in the above screenshot, Azure DevOps will not be able to search it and it recommend us to install an Azure DevOps marketplace extension called Code Search. Please go ahead and install the extension.
Once you install the extension, search for something in the search bar which would result something shown below.
The above would happen if you try to search immediately after installing the extension. In my case, I tried to search again after 10 mins and was able to view the results as shown below.
So far, it’s pretty simple and it’s good to find the search results. However, by default, the component only searches in the default branch (in my case it’s master). It doesn’t search in the other branches.
Let’s say, you would like to search for something else (HomeController_develop) as shown below which is in a branch called develop.
By default, as the search happens only in default branch (in my case, it’s master), the search wouldn’t shown the results as shown below.
As the search didn’t result the search term, we can include non-default branches by clicking on the Include Searchable branches which takes us to the Repository page where you can add more Searchable Branches (up to 5) as shown below.
Click on the ‘+’ button which opens up a popup where you select the develop branch and add it. Once you add the develop branch, the Searchable Branches section would be something as shown below.
Let’s now, run the search and select the develop branch in the Branch dropdown as shown below and you could search for any term in the selected branch as well.
That’s how the Code Search extension helps us in searching something in feature branches
In this article, we have learnt about a new Azure DevOps marketplace extension called Code Search which helps us in searching a term of a git repository from multiple branches.
Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups