Multi-repo Support In Visual Studio
Have you ever needed to work on a solution with projects hosted on different Git repositories? Previously, you had to either use multiple instances of Visual Studio or rely on external Git tools. Starting with Visual Studio 2022 Preview 3, you can enable the multi-repo support preview feature which will enable you to work with a single solution with projects in multiple repositories and contribute to them from a single instance of Visual Studio.
The easiest way to enable multi-repo support is to use CTRL+Q, type “preview” and open the preview features pane. Scroll to “Enable multi-repo support” and toggle the checkbox. This functionality is still a preview feature, which means we are working hard to add more support in the coming releases. In the meantime, we’re depending on your feedback, the community, to build what you need.
Open solution with projects in different repositories
If you already have a solution with projects hosted on different Git repositories, just open your solution using Visual Studio’s Start Window or using File > Open > Project/Solution and Visual Studio will automatically activate up to 10 repositories at the same time. You will be able to tell if Visual Studio has activated your different Git repositories by looking at the repository picker on the status bar (located at the lower right corner), which will tell you the number of active repositories you have. Active repositories show bolded on the repository picker.
You can also add projects hosted on different repositories to your existing solution by right clicking on your solution in Solution Explorer and selecting Add > Existing Project.
The Git Changes Window will automatically track changes cross repositories. All you need to do is write a commit message and click the “Commit All Repos” button for all of your changes to be committed. You can also choose to stage your changes first which enables you to choose the repositories you would like to commit to. Alternatively, you can use the repository picker at the top of the Git Changes window to focus on and commit changes to one repository at a time.
Amend, Stash, Branch switching & Network operations
Multi-repo support for Amend, Stash, Branch switching and network operations including Pull, Push, Fetch and Sync is coming to the Git Changes window in future iterations. To use any of these operations now, you will have to use the repository picker to focus on one repository at a time. Alternatively, for branching you can rely on the Git Repository Window as demonstrated in the following section.
Branch & Repository Management
The Git Repository window recognizes all active repositories and provides cross repository browsing and management experience. You can preview, create, manage, and switch branches right from this window. Commit details, embedded diff and incoming/outgoing commits all function as they do with single repositories.
Let us know what you think
We have benefitted greatly from all the rich feedback we’ve received from you – thank you! We hope you’ll help us continue to improve by giving the new multi-repo preview feature a try and letting us know what you think by taking the following quick survey:
>>> Read the Full Story at Visual Studio Blog