Skip to content

Discard changes not working properly, still appears in git status #28326

Closed

Description

  • VSCode Version: 1.13.0
  • OS Version: Microsoft Windows [Version 10.0.15063]

Steps to Reproduce:
I discard the changes from a file in VS Code but it still appears when I run git status.

image

Activity

  1. joaomoreno commented on Jun 14, 2017

    @joaomoreno
    Contributor

    If you close Code and open it again those changes still don't appear?

  2. added
    info-needed
    and removed
    git
    on Jun 14, 2017
  3. iamdevlinph commented on Jun 14, 2017

    @iamdevlinph
    Author

    João Moreno (@joaomoreno) Just checked. Still doesn't appear on Code restart.

  4. joaomoreno commented on Jun 14, 2017

    @joaomoreno
    Contributor

    Does it happen only with that specific filter.component.js file? Or other files won't show up either?

  5. iamdevlinph commented on Jun 14, 2017

    @iamdevlinph
    Author

    It happens to any file. It's the Discard Changes functionality itself that is somehow acting up.

  6. joaomoreno commented on Jun 14, 2017

    @joaomoreno
    Contributor

    That sounds very odd. What does git status -zu return? Can you provide a movie screencast reproducing the issue?

  7. iamdevlinph commented on Jun 14, 2017

    @iamdevlinph
    Author

    The file which I did Discard Changes appears in the result of git status -zu.

    I will provide one ASAP.

  8. iamdevlinph commented on Jun 14, 2017

    @iamdevlinph
    Author

    Here is the screencast. The file in mention is index.html.

    I added a comment line, <!-- Changes here --> , in the file; saved it, and there it appears in the Changes which is perfectly fine.
    Then I did a Discard Changes on this file, the changes were "removed" from the file shown. But when running git status -zu; git status, the file index.html is still here.
    And restarting Code doesn't help.

    View my screencast here

    Sorry about the choppy quality. Was just testing this app out. If you want, I can try it again with another recording software which I think produces better quality.

  9. joaomoreno commented on Jun 15, 2017

    @joaomoreno
    Contributor

    Code seems to be doing the right thing here... just the command line git seems to be doing the wrong thing... So... if you go to disk, what are the real contents of that file, if you open it in Nodepad?

  10. iamdevlinph commented on Jun 15, 2017

    @iamdevlinph
    Author

    Hmm. Weird. The change is not there when I opened the file in Notepad.

    It's really the CLI git acting up.

    Discard change in Code is equivalent to git checkout -- file/to/path?

  11. joaomoreno commented on Jun 15, 2017

    @joaomoreno
    Contributor

    You can see exactly what Code calls git with by running Git: Show Git Output.

    Closing since the issue isn't related to Code.

    Maybe it's related to the fscache setting: https://superuser.com/questions/974078/what-does-the-filesystem-cache-do-in-windows-7

  12. iamdevlinph commented on Jun 15, 2017

    @iamdevlinph
    Author

    Turning fscache on or off doesn't help. Running Code as admin doesn't help either.

    I found that Discard change in Code runs git checkout -q -- file/to/path.

    I copied this command and put in the cli and it works properly.

  13. iamdevlinph commented on Jun 15, 2017

    @iamdevlinph
    Author

    I think the problem is with Ubuntu on Windows.

    Running git status in Git bash doesn't show any file.

  14. joaomoreno commented on Jun 15, 2017

    @joaomoreno
    Contributor
  15. iamdevlinph commented on Jun 16, 2017

    @iamdevlinph
    Author

    Issue was with the file configuration in git.

    Need to have the following set as:

    git config --global core.autocrlf true
    git config --global core.filemode false
    

    Read more here

  16. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions