Source Control in VSCode is not refreshed automatically

23.5k Views Asked by At

I have updated Mac OS from Sierra to Monterey recently. Since then I have been facing some issues. One of them is in VSCode, when I do changes to the files the changes are not reflected in Source Control or Explorer until the refresh button is clicked manually in Source Control Tab. Can anyone help me out to solve this issue?

I have git 2.16 installed in my machine.
I have updated the version of VSCode and git.autorefresh is set to true.

Update 1:
I have reinstalled git. Now I have git 2.35.1. But still, the Source Control tab is not auto refreshed.

5

There are 5 best solutions below

3
vbrin27 On BEST ANSWER

I had my project in /System/Volumes/Data/<my-folder-name>. After moving to /Users/<user-id>/, it started working. I even created a simple project in both the folders and tested them. Project in the former path faces the issue whereas the latter one doesn't face any issue. So I moved my work to the Users folder but I don't know the root cause.

6
MHM On

As Visual Studio Code "Version Control" page mentions:

Note: VS Code will leverage your machine's Git installation, so you need to install Git first before you get these features. Make sure you install at least version 2.0.0.

So first of all make sure you have installed git on your machine(GIT FOR macOS).

Then

  • Open the command palette in vscode(In mac,Press ‘’Cmd + Shift + P’’):
  • Type "open settings"
  • choose "Open Settings (JSON)

In the setting.json file, add the following flag for auto-refreshing: "git.autorefresh": true,

Then save the changes. your problem should be solved.

In addition, There are more git config that you can use them(just type git in setting.json file for more options)

0
Richard Whitfield On

Even though my setting in 'Open Default Settings (JSON)' had "git.autorefresh": true, I also had to add this to 'Open User Settings (JSON)' and now it works.

0
Mistborn On

I had the same issue, when I staged/unstaged parts of a file, it would not update before I switched to another window and back again. I'm on Ubuntu 22.04 LTS with Git 2.34.1 and vscode 1.74.3. I set this config in vscode:

"git.closeDiffOnOperation": true

Edit: Unfortunately this only works on my desktop and not my laptop, even though they both run the same ubuntu, git and vscode.

0
Sheldon Oliveira On

This problem seems to happen in different versions for different reasons. As of April 2023, I solved it by cmd + p -> "git: open repository" -> select your main git repository. Probably because I opened a subfolder only instead of the main one with git.