Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS Code discard changes; running git status still shows file #2222

Closed
iamdevlinph opened this issue Jun 15, 2017 · 8 comments
Closed

VS Code discard changes; running git status still shows file #2222

iamdevlinph opened this issue Jun 15, 2017 · 8 comments

Comments

@iamdevlinph
Copy link

iamdevlinph commented Jun 15, 2017

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
3

I opened an issue in VS Code thinking there something wrong with Code but nope.

@stehufntdev
Copy link
Collaborator

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?

@iamdevlinph
Copy link
Author

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
Copy link
Author

iamdevlinph commented Jun 16, 2017

The Discard changes in vs code runs git checkout -q -- f:\path\to\index.html and the directory-ing in bash on windows is mnt/f/path/to/index.html.

I don't know if that makes any difference.

@iamdevlinph
Copy link
Author

iamdevlinph commented Jun 16, 2017

Another thing I noticed when running git --version, Git bash and Bash on Windows have 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 git in Bash?

@0xbadfca11
Copy link

What about the values of core.autocrlf and core.filemode?
I think they are probably the same as these. #184 #1352

@iamdevlinph
Copy link
Author

iamdevlinph commented Jun 16, 2017

My core.filemode is false but I don't have core.autocrlf set.


Issue is fixed by setting git config --global core.autocrlf true.

Closing.

@ms-afk
Copy link

ms-afk commented 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
Copy link

lco-sp commented 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants