julian bechtold
julian bechtold

Reputation: 2251

How to change and create multiple repositories in Visual Studio 2022 - 17.04

I have a solution called Finanzdurchblick_Solution

Within that solution, I have a main project Finanzdurchblick and two referenced projects Category_Helper_Project, CSV_Helper_Project and an additional secondary, local project String_Helper_Project

When I go to the git Changes page, I can see that the String_Helper_Project is selected. I could stage changes I make in String_Helper_Project but there are no unstaged changes. Changes in my Main Project Finanzdurchblick are not included:
enter image description here

When I open the Git dropdown at the top of visual studio, I can see the local repositories for my referenced projects but my main poject Finanzdurchblick is not visible there:
enter image description here enter image description here

How can I add a local repository for my main project? And how do I switch to it in the Git Changes window? I am used to see a button "Add repository" when there is no repository yet. From there I could choose to push to a remote location or keep it locally.

I have also checked out the Create Git Repository page but could not find how to create one there. Interestingly, it references my String_Helper_Project in the path there:
enter image description here

I already checked the solution folders and could not find any .git folders.

Edit: in my Solution explorer, I found that String_Helper_Project is "checked" in, when I hover the Mouse over the small blue Lock beneath it.

Upvotes: 1

Views: 10058

Answers (1)

julian bechtold
julian bechtold

Reputation: 2251

Enable Repo Switching in Git Changes and other areas:

Visual studio 2022 adds the support for multiple git repositories in one solution.

This is still a preview feature. To enable the feature:

  1. Press Control + Q to open the search function or use the searchbar at the top of visual studio.
  2. type features and choose the search result which states Environment > Preview Features
    enter image description here
  3. Enable Enable Multi Repo Support (requires Solution to restart)
    enter image description here
  4. Restart your visual Studio

Now you should be able to switch between your Repositories In the Git Explorer and Git Branch Explorer:
enter image description here

Add new Repositories

In order to Add new Repositories, go through the File Menu:
File > New > Repository

There you will find the Option to add a new (local) Repostitory. enter image description here

Make sure to choose the proper path to your project. enter image description here This will also generate the gitignore files which are not included when creating the repo with an external application.

Upvotes: 3

Related Questions