Search code examples
gitvisual-studiobranchvisual-studio-2022git-branch

Visual Studio switch/merge/get rid from multiple repository/branches to single repository/branch


Regarding Visual Studio 2022 I have had repositories/projects:

a) C:\_GIT\RepositoryA\Project1
b) C:\_GIT\RepositoryMain
  1. I have moved Project1 folder from a) to b)
  2. Changed some files or somehow at some point I noticed that I am working on multiple repositories\branches a) + b).
  3. I can open C:\_GIT\RepositoryMain\Poject1\Project.sln directly but it opens as multibranch project.
  4. While commiting I am able to choose repository/branch inside this project but I'd like to get rid of a) repository\branch inside sln and stay with single b) repository\branch. The directory has been moved and shouldn't exists in a)

Solution

  • Ok i found solution (needed stackoverflow and work colleague as rubber duck)

    My copied C:\_GIT\RepositoryMain\Project01\Project01.sln included 3 projects and one of them has relative path like:

    Project("{FA807EC9-801F-11D4-BF68-00CB4F79EOBC}") = "Project01.Tests", 
    "..\..\..\..\Project.Tests\Project.Tests.csproj",
    

    Which leaded to a) repository. I have removed all '..', now sln opens as single repository\branch