Shyam Narayan
Shyam Narayan

Reputation: 1231

Visual Studio 2022 source control not showing changes

Visual Studio 2022 not showing any change of file in git changes window, although there are some files updates are available. Whereas GIT GUI is showing all the changes in the repository.

Once I open the repository in GIT GUI all changes are also begin to display in Visual Studio git changes window.

Upvotes: 14

Views: 24212

Answers (8)

Talha
Talha

Reputation: 1

The issue can be because of changing of action from three dots in the Changes section of Git in visual studio. in my case It was set to Open File as Default Action and i was unable to see changes

Click image to see the option

I solved this issue by clicking on the three dots and then selected > Compare file as default action.

This solved my issue and i was able to see changes between two files.

Upvotes: 0

FaultyOverflow
FaultyOverflow

Reputation: 303

Had the same issue. In my case, a setting caused Git to not reflect changes in the Solution Explorer window. Go to menu "Git\Settings\Git Global Settings", scroll down and in Tools section, set "Diff Tool" and "Merge Tool" to "Use Visual Studio" instead of None.

Upvotes: 0

gojimmypi
gojimmypi

Reputation: 526

Look for bad filenames, particularly those not supported by Windows.

I encountered the problem of Visual Studio 2022 (specifically Version 17.7.4) not detecting changes. This was on a repo cloned using WSL onto a shared filesystem , in my case mnt/c/workspace. Oddly, things like git status did show there were changes.

The root cause turned out to be a bad filename in the root of the repository, specifically an icon name with a carriage return in the name.

I was able to find this by using the View-Other Windows-Package Manager and running git status there.

Alternatively, cloning the repo directly to the Windows/DOS file system can also be used to detect the problematic file. Any serious problems will cause the clone to fail. WSL of course does not have a problem with this, but Visual Studio 2022 did not expect it. There was otherwise no error.

Upvotes: 0

Muhammad Sulaiman
Muhammad Sulaiman

Reputation: 2605

TL'DR

Make sure both git and vs are up-to-date + use git status and if you got a fatal: detected dubious ownership error, then run git config --global --add safe.directory '*' and restart VS, finally, if none of these works and your local and remote copies are synced: delete the local copy and re-clone the repo again!


Possible Causes:

  1. Git, VS Versions' mismatch: I have VS2022 up-to-date, but git-bash -> git --version was 7-versions old, so I have used git-bash -> git update-git-for-windows command to have an up-to-date version of git (you can download the 'git.exe' installer as an alternative). This shows git information in vs statusbar, but some solutions still not showing the git information! if this not works for you, try the next step..

  2. In Visual Studio: View -> Other windows -> Package Manager Console, then type git status. In my case, it gives me a security fatal error!

    git : fatal: detected dubious ownership in repository at 'path-to-solution'
    At line:1 char:1
    + git status
    .
    .
    

    To overcome this, I have used the following command to get rid of this issue forever: git config --global --add safe.directory '*'

  3. If the project is relatively old, try re-cloning it again (if local and remote are synced, if not: delete the .git folder, clone the repo to a new folder, copy the .git folder from there and paste it in root folder, add and commit your changes).

Upvotes: 0

Benedikt Bermel
Benedikt Bermel

Reputation: 31

I ran into the same issue. Then I found the answer under this video. Try this:

git config --global --add safe.directory C:/Path/To/Repo

Notice the forward slashes.

Upvotes: 3

Saulius
Saulius

Reputation: 2006

I used to connect not as admin. Then in Git Repository Settings no remotes were displayed and at Git Changes there were only "create new" options.

Then I connected as admin and remotes become available, all were working as usual. Makes no sense to me but it's "working".

Upvotes: 1

user3770256
user3770256

Reputation: 151

visual studio 2022 shows "error parsing the git status output.". It is maybe because of mismatched versions of git or visual studio.

as a workaround, in "Package Manager Console" you can run this command:

git status

after that, visual studio shows your changes, and you can commit them!

Upvotes: 12

Keith Bluestone
Keith Bluestone

Reputation: 165

It might be an issue with the git index lock. This solved my problem, deleting the index lock file: Visual Studio: Git Team Explorer does not show any changes

Upvotes: 0

Related Questions