Link to home
Create AccountLog in
Avatar of Babak Sekandari
Babak SekandariFlag for United States of America

asked on

Why does Solution Explorer not change to reflect the Git branch I'm in?

In Visual Studio 2022 , I created a test branch called RepoRemoveTest. 

Then, while in that branch I went to Solution Explorer and added a file called DeleteMe.

However, when I switch branches, that file still exists in Solution Explorer.

Does Solution Explorer not reflect the branch I'm in?

Here are some images to illustrate:

I started off from a master branch:

User generated imageThen I created a temporary test branch:

User generated imageThen I went to Solution Explorer and added the file, DeleteMe:

User generated imageBut when I switch to the master branch, Solution Explorer continues to show the DeleteMe file.

What's happening here?

Is the file in both branches? That can't be.

Is Solution Explorer not reflecting the branch I'm in? If so, how do I fix that?

Avatar of Qlemo
Flag of Germany image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Babak Sekandari


Okay, thanks. That worked.

I committed the file and now the branches look appropriately different when I switch.

Could you add some clarification please about why this happened. I partially understood your explanation but I'm still a little bit fuzzy.