Home > Mobile >  VSCode git not detecting changes unless manually saving file
VSCode git not detecting changes unless manually saving file

Time:10-07

My first time using git with VSCode I had the experience of the file changes showing up in the Source Control even without saving them although now that doesn't happen anymore unless I manually save the modified file and that's when it appears in the 'Changes'. I haven't changed any settings/configuration and I'm not sure if manually saving a file within the repo in VSCode might've had an effect because I remember doing that before pushing and closing the editor.

I'd like to expand on this issue by detailing the previous behavior of my VSCode. After cloning a remote repo, git would automatically detect changes in existing files even though they haven't been saved yet although when a new file is added (say a text file) it had to be manually saved first and from then on Source Control would detect any changes to that file without having to save it.

CodePudding user response:

It's the right behaviour of how VS Code works with Git though. You save the file, then the editor (VS Code) notices the changes of the file, and shows it to the Source Control tab. Maybe the case when you first use the VS Code, is when you create a new file, and VS Code will also notice it.

CodePudding user response:

Managed to get the 'old behavior' back thanks to TTT. I set the File Auto Save settings to onFocusChange and it behaves similarly to how it used to although I'm not sure why it stopped doing the old behavior as the settings were untouched and Auto Save was off by default. Anyway, thanks again to TTT.

  • Related