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:

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:

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:

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.
CodePudding user response:
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:
- Press
ControlQto open the search function or use the searchbar at the top of visual studio. - type
featuresand choose the search result which statesEnvironment > Preview Features

- Enable
Enable Multi Repo Support (requires Solution to restart)

- Restart your visual Studio
Now you should be able to switch between your Repositories In the Git Explorer and Git Branch Explorer:

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.

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