Search code examples
gitvisual-studio-codesalesforce

Git in Visual studio code says file is modified even when there is no change


I am using the Visual Studio Code for my salesforce development. I have some issues with Git as a repository. When I right-click on the package.xml and say Retrieve Source From Org, it is getting all the files from Org.

The problem is git extension is showing file is modified on the server even though I have a sample file in my local. I don't want to push all the files again and again to my git repo even when there is no change.

enter image description here

Any idea why this is happening and how to avoid it?

Update: I did git diff and it provides correct output. It only shows file changes that are modified. In this case only five.


Solution

  • I was able to resolve it by executing the following command

    git config --global core.autocrlf false
    

    Documentation: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#:~:text=with%20these%20issues.-,core.autocrlf,-If%20you%E2%80%99re%20programming