'Why does Visual Studio think I'm on a different branch than my terminal and VS Code
I have a .NET 5 solution, using git for source control.
- If I open it in Visual Studio 2019, the branch selector at the bottom right says
foo - If I navigate to the root directory in a terminal window and check the current branch with
git rev-parse --abbrev-ref HEAD, it says I'm on branchbar - If I open the root directory in VS Code, it also says I'm on branch
bar - If I checkout another branch from my terminal like this:
git checkout main, then both my terminal and VS Code say that my current branch ismain, but VS2019 still saysfoo
What's going on?
Solution 1:[1]
Still not sure why this was happening, but deleting the .vs folder and restarting the solution/VS2019 seems to have fixed it.
Root Directory
- .git
- .gitignore
- README.md
- src
+ .vs // deleted this and restarted VS2019
+ MySolution.sln
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Michael Harris |
