Monday, September 6, 2021

Visual Studio 2022: Introducing Multi-Repo Support

Let's say we have a solution with 2 Projects and these projects are hosted in two different Git repos (it can be any Git provider like GitHub, Azure DevOps, BitBucket etc). You are working on both the projects at the same time and committing changes. 

In this kind of a scenario, if you are using an earlier version of Visual Studio, for example, Visual Studio 2019, handling/committing changes can be a real pain. If you have the solution opened, Visual Studio will be tracking only one repo at a time, so you need to be extra careful when committing changes to select the appropriate target repo using the Repo Selector in the bottom toolbar of Visual Studio. 
Visual Studio 2019: Repo Selector (one at a time)
Visual Studio 2019 - Git Changes
Or you will have to use different Visual Studio instances, or use another git tooling to commit the changes.

But as the Visual Studio team is trying to make the git experience within Visual Studio more user-friendly, Visual Studio 2022 Preview 3 has introduced this new feature which is Multi-repo support. As of today it's still in its Preview and is disabled by default. If you want try out this feature, you need to explicitly enable it by navigating into Tools -> Options -> Environment -> Preview Features and turning on Enable multi-repo support.
Visual Studio 2022 - Enable multi-repo support
Once you have enabled multi-repo support and opened up a solution with multi repo projects, you will see Visual Studio is automatically identifing different repos in the solution. It will bold out the active repos within the list of all the repositories.
Visual Studio 2022 - Enable multi-repo support
And when you are trying to commit the changes, it will show all the active repos and if you want, you can push to all the repos at one single shot.
Visual Studio 2022 - Git changes and committing to multiple repos
Or alternatively, you can select the target repo, and push only it's changes.
Visual Studio 2022 - Git Changes and committing to a single repo
And when you go to Branches Window, you get the same features as in single repo solution like managing branches, seeing commit details, checking diff and seeing incoming/outgoing commits, etc.
Manage Branches with multi-repo
Try out Visual Studio 2022 today.

Hope this helps.

Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment