The content on disk is newer. Click on Compare to compare your version with the one on disk

半世苍凉 提交于 2019-12-06 21:52:14

问题


After update to 1.19.1 I'm getting this error constantly. The content on disk is newer. Click on Compare to compare your version with the one on disk.


回答1:


VS Code will show you an error message when you try to save a file that cannot be saved because it has changed on disk. VS Code blocks saving the file to prevent overwriting changes that have been made outside of the editor.

In order to resolve this issue, click the Compare action in the error message to open a diff editor that will show you the contents of the file on disk (to the left) compared to the contents in VS Code (on the right): {Refer an Image}

You must either accept the changes or revert the changes. Without taking any of the mentioned actions, you cant save the file.

P.S Above answer has been referred from visual studio code official documentation.

you can read detailed information about this topic: [https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_preventing-dirty-writes][2]




回答2:


Here is another way:

  1. Copy the full content of your dirty file let say abc.js to somewhere in notepad
  2. Delete the file: rm abc.js
  3. Get the file from the repository(my case its Git): git checkout abc.js
  4. Paste the previously copied content or paste the updated content back and save.

Hope you won't see this issue.




回答3:


Close all editors, when you switch the branch in GIT, then it wouldn't appear




回答4:


Click on the compare button, two screens (left and right) will be displayed, click on the tick mark which appears on the right-hand side(in my case). That's it, it will be saved.



来源:https://stackoverflow.com/questions/47892646/the-content-on-disk-is-newer-click-on-compare-to-compare-your-version-with-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!