You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VS Code discard changes; running git status still shows file #2222
Your Windows build number:
Microsoft Windows [Version 10.0.15063]
What you're doing and what's happening:
After running Discard Changes in VS Code, file still appears when running git status in any shell inside Bash on Windows. Also tried in the native Bash on Windows terminal (without ConEmu), no difference.
But when running git status in Git bash the file is not there. git status seems to be not working properly inside Bash on Windows.
What's wrong / what should be happening instead:
When running Discard Changes in VS Code, the file should not be shown when running git status.
View screencast
I opened an issue in VS Code thinking there something wrong with Code but nope.
Thanks for reporting the issue. Looks like this might be related to #1939. Can you please check before and after Discard changes if the file timestamp changes with ls -al <file> to confirm?
I have had the same error, but it was caused by permissions on the wsl linux file system. Github Desktop works under the main user of your wsl distro, so if you create some files using a different user, like root for example, Github Desktop won't be able to discard the changes of those file.
Could this be the problem in your case too?
Same here, although in my case it does not seem to have anything to do with a non-default user in WSL (unless Pengwin does something weird that means that the default user set up during installation is not the 'default' user as seen by Windows). I can use git normally when using a remote connection into WSL through VS Code. On Windows proper, all edited files show as 'modified' even if all changes have already been commited and pushed. Although, so far, my problem is limited to python files. Which just adds to the weirdness (no extensions should be touching those; I disabled everything just to be sure).
Activity
stehufntdev commentedon Jun 15, 2017
Thanks for reporting the issue. Looks like this might be related to #1939. Can you please check before and after
Discard changesif the file timestamp changes withls -al <file>to confirm?iamdevlinph commentedon Jun 16, 2017
Here it goes.
[1] Before modifying file
-rwxrwxrwx 1 root root 42821 Jun 16 10:45 index.html*
[2] After modifying
-rwxrwxrwx 1 root root 42826 Jun 16 10:46 index.html*
[3] After
Discard Changes-rwxrwxrwx 1 root root 43365 Jun 16 10:46 index.html*
iamdevlinph commentedon Jun 16, 2017
The
Discard changesin vs code runsgit checkout -q -- f:\path\to\index.htmland the directory-ing inbash on windowsismnt/f/path/to/index.html.I don't know if that makes any difference.
iamdevlinph commentedon Jun 16, 2017
Another thing I noticed when running
git --version,Git bashandBash on Windowshave different versions.Git Bash: git version 2.13.0.windows.1
Bash on Windows: git version 2.7.4
Should I try to update the
gitin Bash?0xbadfca11 commentedon Jun 16, 2017
What about the values of core.autocrlf and core.filemode?
I think they are probably the same as these. #184 #1352
iamdevlinph commentedon Jun 16, 2017
My
core.filemodeisfalsebut I don't havecore.autocrlfset.Issue is fixed by setting
git config --global core.autocrlf true.Closing.
ms-afk commentedon Oct 22, 2023
I have had the same error, but it was caused by permissions on the wsl linux file system. Github Desktop works under the main user of your wsl distro, so if you create some files using a different user, like root for example, Github Desktop won't be able to discard the changes of those file.
Could this be the problem in your case too?
lco-sp commentedon Jan 31, 2024
Same here, although in my case it does not seem to have anything to do with a non-default user in WSL (unless Pengwin does something weird that means that the default user set up during installation is not the 'default' user as seen by Windows). I can use git normally when using a remote connection into WSL through VS Code. On Windows proper, all edited files show as 'modified' even if all changes have already been commited and pushed. Although, so far, my problem is limited to python files. Which just adds to the weirdness (no extensions should be touching those; I disabled everything just to be sure).