Multi-repository Support Released!
As one of our most highly requested features with Developer Community, we are so happy to announce the release of multi-repository support in Visual Studio 2022. Support for multiple repositories means you can have up to 10 active Git repositories at once. This allows you to work with a solution that spans more than one repository, enabling git operations accross several repositories at the same time. For example, in a large web project you may need different repositories to manage work done on the frontend, the API, the database, the documentation, and various libraries and dependencies. Before multi-repository support, you may have needed to open multiple instances of Visual Studio to work between repos, but now you can manage, view, and debug them all with one instance of VS.
Start using multi-repository support by updating your Visual Studio 2022 to version 17.4 or later and opening a solution or folder with projects across several repositories. Check out our sample solution here that spans multiple public GitHub repositories to see how this works!
Are you new to Git, GitHub, and version control?
Start utilizing GitHub in Visual Studio to its full potential by signing up for the GitHub learning series.
Branch Management and Tracking Changes
Multi-repository support extends the capabilities of the Git Changes and Git Repository windows. This means managing your multi-repo scenarios works the same as working with a single repository. You can create your branches across several repositories at once in the extended Branch creation dialog.
Then, as you make changes, the Git Changes window tracks your work separated by repository. This allows you to stage and commit as you normally would.
You can use the branch pickers in the status bar and the Git Changes tool window to switch branches. Simply click on the branch you’d like to checkout. Additionally, you can perform inner loop branching operations like merging, rebasing, renaming, deleting, and comparing branches by right clicking on the branch. You can perform more advance repository and branch management operations in the Git Repository Window.
Once you’re ready to commit, the network operations dialog makes it easy to specify the exact branch you’re pushing to and reorder your pushes. This same dialog allows you to exercise more control over other network operations, like Fetch and Pull.
Updates to the Git Repository Settings page allows you to specify your options for each repository. For example, you can specify whether to prune remote branches during fetch.
Additionally, you can activate multiple repositories from a Folder in addition to from a Solution.
Building with Your Feedback and What’s Next
Users were requesting help dealing with context switching, collaboration and debugging, and organizing their code. We collected feedback that developers were using other Git clients or even multiple instances of VS to apply Git operations in different repos, projects, and solutions. We also heard that many organizations were creating NuGet packages to get internal dependencies that should just be easy to consume from a separate repo. Finally, users needed a better way to manage things like microservices, separate projects, and scripts or pipelines.
We started by scoping our support based on the open solution and expanded the support to folder scenarios. By focusing more broadly than just on submodule support, we could enable quick cross repo debugging and ensure those not using submodules a seamless experience. A complete submodule experience is on the roadmap for us to tackle in the future.
10 Repository Limit
We currently support up to 10 active repositories at once. We are continuously monitoring the performance impact on I/O, CPU, and UI responsiveness, especially as the size of the repositories can have a large effect. Since less than 0.05% of users are exceeding the 10 repositories in preview, we’ll continue to investigate and take feedback to understand how we can deliver a great experience for all scenarios going forward.
Let us know what you think
Your feedback has informed our work at every step of developing this feature – thank you! Try out the new multi-repository support and let us know what you think by taking the following quick survey:
In my opinion, full submodule support is more important (used more frequently) then multi repo and should have been done first. Am I wrong?
Can the multi-repo support be across different projects in an Azure DevOps organisation ?
Thanks for your question, Dawson!
Multiple Git repos can be active in VS from different hosting providers, and different orgs/projects in Azure DevOps. The local Git operations (commit, etc) and the network operations that use the Git protocol (fetch, pull, push, sync) will work properly for all of those repos.
Excellent, this will really help those moments when you needed two VS open. Microsoft proving they can add value to git.
Jessie, I have seen multiple videos on how this works if you have a solution with multiple repos already in it, but how does one create a new solution and then include mutliple repos? I have three API’s that are cloned into their own local directories that I’d like to combine together into a single project/solution in VS so that I only have to open one VS instance and not 3, but I cannot find help figuring out how to create a new project/solution and then add these local repos in.
Thanks for your question! You can leverage the folder view which works best if the APIs are independent of one another. You can place the local repo directories in the same parent folder and use the “Open a local folder” option from the Visual Studio launch page to open the parent folder. VS will detect and activate each repo, and it will track changes by repo as shown above in the Git Changes window.
If the APIs need to be in the same solution, you can open one of the solutions, right click on the solution in the Solution Explorer, and click “Add > Existing Project,” and select the .csproj file for your other APIs. Once added, VS will detect and activate the repo, and you can adjust Project References as necessary.
Please let me know if this works for you, and thanks for trying it out!
Hi Jessie, we already have Solution files in every Repository, so normal workflow was to open multiple instances of VS. Each Solution had already multiple projects, so creating a new Solution and adding all the projects is quite elaborate. Any good way of merging multiple SLN Files?
“Since less than 0.05% of users are exceeding the 10 repositories in preview” – we have over 60 projects, how is everybody else handling this? Not one repo per project?
The link to the multi-repo sample is missing. It’s just an underlined “here” text.
Thanks for catching that, Hank! It’s been updated, and here’s a direct link – https://github.com/houghj16/SampleAPI, you’ll want to grab the zip file in the README.md of that repo.
Because of an accident I now have two repositories instead of just one, how can I completely get rid of the unnecessary and unwanted repository? At Git-Repository settings there I can only delete the link to the origin, but I want to completely delete the second repository from my solution.
To completely delete the unnecessary and unwanted repository, you’ll want to delete the .git files from that folder.
OneDrive.exe – Application Error
The exception unknown software exception (0xe06d7363) occurred in the application at location 0x00007FF9145DCD29.
Opening the sample VS project gave this error. I had already another project opened.
I tried again this time only opening the sample VS project. Then it was good.
Where can I learn more about the repository icons displayed in Visual Studio ? They are quite confusing.
Hi, I would love to point you in the right direction.
Which icons are you referring to? There are tooltips over icons that are clickable, and different meanings for the icons in the Git Repository window to indicate if a branch is local, remote, being created, etc.
Excellent feature! It almost solves my productivity issues with our multi-repo project, save that we have more than 10 repos.
I get the 10 repo upper limit for performance, but at least a setting where we can adjust the limit would be useful – or perhaps just a config to allow “which” of the top 10 repos are active…
That’s extremely useful feature for me and I was waiting for it more than 2 years but the 10 repository limit almost ruins it entirely. I have projects from 19 repositories in my solution so I still need to monitor them separately outside the visual studio. Is it possible to expect a some sort of a configuration to change or disable this limit in future versions?
I am running 17.4.2, I would love to know how to choose the 10 repositories that are chosen for Git. My solution has about 46 projects in it, and VS just keep choosing the first 10, not very helpful. How do I get to chose the rest of them, even if 10 at a time? I would expect that it would at the very least look for the first ten that have changes, when it opens and when it is done processing. So right now it is worthless for me and my team. I can send you a PowerShell script that I use to track all of this outside of visual studio, maybe it will help out the team.
One other thing, do you need someone on the team that could multi thread the checking process? Because right now you have just automated a manual process and quite frankly I can perform this task 5 times faster by opening 10 copies of VS.
I just found another issue, when I am in multiple (sorry 10) repository mode and pushing I get a list of 10 repos to pull and sync, when I am only working on one. It is really confusing when you have 46 repos and working on 1, and a dialog pops up that says do you want to sync these 10? What, did I miss something goes through my head.
Again I can send you script that will show you everything that has been updated locally.
Thanks for your comment, Lawrence. Allowing users to choose the 10 repos that are activated is in our roadmap.
We’ll look into the issue with the dialog. Thanks for trying out this feature!