I have Windows 10 and am using VS Code, Git for Windows, and WSL2 with Ubuntu 20.04 LTS (which I access via Windows Terminal).
I needed to reset my computer, so I tar.gz'ed a local repo that I had on my Ubuntu and stored that tar.gz on my secondary drive.
After my reset, I reinstalled all of my apps.
I decompressed my repo back into the same location in Ubuntu, then I did a chown -R gesslar:gesslar /path just to be sure that it had my current IDs on it.
In Windows Terminal, using the WSL2 profile, I cd to the /path and do git status and it says I have no changes to commit.
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
However, in VS Code, which I access by going to the directory and typing code . in my WSL profile in Windows Terminal, it says that I have 950 pending changes.

If I use Git Bash, I get a similar reading, and it is showing tonnes of files that are marked as deleted

What's super weird to me is that despite being marked as deleted, the file is actually there.

And under Untracked files, files that it says are new, don't actually exist.
Please if anybody has ideas on what might be funky about this, I'd appreciate some help. My suspicion is it has something to do with Git for Windows, since I think VS Code is using that to determine changes and it's in Git Bash where I see this weirdness.
Note I know that some may suggest that I just reclone, but my working directory is a copy of production and our .gitignore ignores thousands of data files that I need to work with in my working directory and they're kind of all over the place. Recreating the environment is an absolute last effort, if possible.
This is going to sound really dumb, but, I figured out that hadn't installed the Remote WSL extension for VS Code.
This DOES NOT stop the Git for Windows being confused about what's what, however, it does enable VS Code to use the WSL version of git rather than the Git for Windows.
Therefore, the result is that VS Code is now aware of the actual state of my git repos/working directories within my WSL2 instance.
Thank you for your help, TTT. I really appreciate your responses and I did learn some things from them. ♥
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With