The problem here is not in the visual studio, but in the work of git. When you fetch a branch in git, it puts that branch in your working tree (file structure, as you want to call it).
With git, you can only check one branch at a time, but wait, there is a solution! Using the git worktree you can create a second working tree for the same repository in a different directory. You can then open this working tree in Visual Studio to test two different branches.
Suppose you have "C: \ projects \ the_project" and you want to create a new working tree, say, "C: \ projects \ the_project_2", open git bash, go to the project directory and run git worktree add../the_project_2 <branch> where is the branch you want to check in the new working tree.
This will create a new directory ("C: \ projects \ the_project_2") and extract the branch into it, without having to clone the repository again.
See the git worktree documentation for more information.
Note. Earlier versions of Visual Studio did not know how to handle additional working trees, and did not recognize them as git repositories.
Ripp_ source share