It’s no big surprise that I’m a big fan of database/dwh development with Database Projects and Azure DevOps. Ever since I started using it, I try to keep my local branches as clean as possible.
Since I swapped laptop last year, I started to use a third party tool to manage branches. In the beginning of 2023 I switched over back to Visual Studio to manage branches since for some reason the tool I was using was not working anymore. (I was required to switch Azure DevOps environments, and by doing this the tool didn’t function properly anymore)
Normally everything should be working fine but after executing a Fetch in Visual Studio, I was seeing a lot of branches in the remotes/origin view folder as shown in the image.
Since I knew that there barely were any branches left, since we just did a major release with a lot of new features and bugfixes included, I checked my Azure DevOps repository just to be sure.
As you can see on the image above, there are only 3 branches left, main, development and 1 feature branch.
I opened my Visual Studio Database Project once more and tried to execute the Fetch action once more. Unfortunately with the same result.
Since I wasn’t having this issue when using my external tool, I knew that I needed to take a look at the Visual Studio Source Control settings. To get there, you just need to navigate to Git, Settings…
As soon as the Settings window has opened, I navigate to Source Control, Git Global Settings. At this subsection, there is an option called: “Prune remote branches during fetch”. This option was set to Unset, I switched it to “True” and confirmed by clicking OK.
Now, it is time to test if this change made any difference. As soon as I executed the Fetch in Visual Studio, I finally saw a clean remotes/origin view folder in the Git Repository Window.