githubvisual-studio-codegithub-desktop

How to remove or modify a repository from vscode


I just added my repository to vscode source control (using the Initialize repository button) and it now says I have 1800 changes. In Github Desktop it correctly shows two changed files. What should I do?

Should I remove the repository from vscode and how and then readd it back in? Is there a way to check where vscode is getting the repository? Maybe it is checking the wrong directory? Or maybe it is correct and github Desktop is incorrect?

vscode:
enter image description here

github desktop:

enter image description here

Note: My folder that is open in vscode is a subfolder of the main repository.

Example:

/mygitproject
/mygitproject/workingfolderinvscode

Before:

enter image description here

Update:
Restarting vscode popped up this message:

enter image description here

Closed the project and opened the parent folder and got the same message mentioned above. This time some folders and files are unchanged and others are untracked. Adding right side of file explorer (screenshot below). Actually, on opening the folders I see that all the files all untracked and now the folders show untracked.

enter image description here

Update:
I've opened the source control view now, after opening up the parent branch and I see two repositories listed. The top one shows the correct number of changes and the bottom one the incorrect.

enter image description here

UPDATE:
It looks like if I right click on the name of the repository I get a few options including, "Close Repository".

enter image description here

I'm going to close the repository that shows as the subdirectory and keep the repository that includes the projectd from it's root directory.

Great success!

It is showing up correctly.

enter image description here


Solution

  • Apparently, vscode did not like that I had a sub folder open instead of the root folder (the one with git folder).

    I then opened the folder that had the git folder in it.

    It then showed two repositories.

    enter image description here

    To close the first repository, I right clicked on the repository name in the source control panel and chose, "Close repository".

    enter image description here

    It now shows the correct information.

    But that is not all. When I reopened the project the first repository opened again causing the same issue as before. I found a .git folder in the subdirectory and have deleted it.