gitvisual-studio-2022git-subtree

Confused about what Visual Studio 2022 is doing with Git Subtree


Currently using Visual Studio 2022 17.4.4. I have a Git repo that contains a subtree folder. Within Visual Studio, the Git Changes window shows two repositories - one for the main repo and another for the subtree. However, VS does not seem to track changes made in the subtree unless I switch to that repo in the Git Changes window. From my understanding of subtrees, the contents are supposed to be tracked with the main repo, so I am not sure why Visual Studio is listing it as a separately tracked repo (Note that VSCode Git interface does not behave this way).


Solution

  • Found the problem. Somehow the subtree folder had a .git folder in it. Not sure how it got there, but that was causing VS to show it in the Git Changes window. I re-cloned the repo into a new folder. After the clone of the main repo, the subtree folder did not have the .git folder in it, which is what I would have expected and VS now doesn't see it as a second repo.

    Turns out this was not a VS 2022 problem after all.