-->

TortoiseGit modified sign (icon overlay) is not up

2020-05-12 07:01发布

问题:

I have made a small change in some code but TortoiseGit shows it as modified (red exclamation sign) although I have committed, pulled, pushed, but it stays. What should I do here? I have not seen this issue before.

回答1:

I'm assuming you are using tortoise git? I've had the issue before, sometimes pressing F5 fixes it other times it just goes away after tortoise resyncs itself.

Here is another possible fix link.

The current workaround is to kill TGitCache.exe with the Windows task manager.



回答2:

What helped for me was the following:

  1. Go to "Settings -> Icon Overlays" Check under "Status cache" the option "none"
  2. Refresh the explorer F5
  3. Go back and change the cache option back to "Default"


回答3:

Kill TGitCache.exe works for me. .... I put this as an answer because I don't have enough reputation points to add it as a comment. But wanted to help further iterate that it is a working solution.



回答4:

There is a workaround that I have tried:

Rename the directory of the repository and then change it back and you are good to go!

As an example: MyComplexProject can be changed to MyComplexProject1 then back to MyComplexProject.



回答5:

Apart from what @Andy mentioned, you can make the overlays work faster by limiting the folders that it has to monitor.

Right click-> TortoiseGit -> Settings -> Icon Overlays

Here enter include and exclude paths. I usually explicitly point to the my repos / working copies:



回答6:

Please check your path to see if it matches in case.

Some/Dir/SomeFile.ext

is the same to windows as

some/DIR/someFILE.EXT

But to Git they are in different locations. This is remedied by navigating back from the top with the proper casing.



回答7:

When the icons are not updating you can quickly kill the icon overlay cache using the following "Run" command:

taskkill /f /im tgitcache.exe

The cache process should restart itself automatically. You can even turn this into a desktop shortcut if you notice it happening frequently.



回答8:

I had the same issue at Windows.

Killing TGitCache did work for a couple of seconds but the red icon appeared again.

It turned out the file was renamed (first letter was changed from uppercase to lower case) locally but was not changed in Git. Windows is case insensitive but Git is! So the icon overlay did not match anymore. I did find this out by removing the specific file and selecting "revert" from the Turtoise Git context menu. In the list, two files did show up, one with first letter uppercase, the other complete lowercase.

Finally renaming the file from the Git context menu did resolve the issue for me.



回答9:

It's a known issue in TortoiseGit. It exists for years and will apparently never be fixed. I don't know whether it's because the TortoiseGit developer is unwilling or unable to do it. (I've also reported it before but can't find the issue anymore now.)

Anyway, here's what I do to resolve it:

git gc --prune=all --quiet

It prunes the Git repository, repacking all those single object files, reducing the number of files in .git from up to tens of thousands to under 20, and probably improving the overall performance of Git operations.

Sometimes Git does a light version of that on its own after a commit, but I've rarely ever seen this happen in years of daily use. So I just do it myself. This is also a great action to consider before making a backup of the system (see below).

To make it easier, I've created a batch file git-gcall.cmd in an accessible path that calls the command shown above. I have to run it after virtually every single commit and after 2–3 seconds the icons update themselves. No killing involved. Just waking up TortoiseGit a bit harder to actually observe the repository and update its status.


Here's a PowerShell script that runs this command in a set of configured directories recursively, if necessary, for use before making a backup. It can also be run on a regular basis, for example over night, to resolve this outdated icons issue in the background.

gc-all-git.ps1:

Write-Host "Packing Git repositories where necessary..."

function Git-Gc($path)
{
    cd $path
    Get-ChildItem . -Recurse -Hidden .git | Foreach-Object {
        cd $_.FullName
        if ((Get-ChildItem objects -File -Recurse).Count -gt 50)
        {
            cd ../
            Write-Host $(Get-Location).Path
            git gc --prune=all --quiet
        }
    }
}

Git-Gc C:\Source
Git-Gc C:\xampp\htdocs

Call it with the usual required accompanying batch file:

gc-all-git.cmd:

@echo off
cd /d "%~dp0"
%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy unrestricted -File gc-all-git.ps1
exit /b %errorlevel%


回答10:

I think this issue happened for me to due to applications competing for Windows limit icon overlays (I believe it allows a maximum of 15).

This is what I had to do to resolve this issue:

  1. Open regedit and browse to the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers key.
  2. Rearrange the subkeys to that the Tortoise* keys were at the top by prefixing with spaces.
  3. Restart Windows Explorer using Task Manager.

See also: TortoiseGit not showing icon overlays



回答11:

None of the other options here could make the problem go away. (I wasn't able to identify any file that had a change in casing) I was pretty confident that everything was checked in as it should be so I just deleted my repo and checked it out again. Poof, works again.

If you're not as confident (or you just don't want to risk it, as is best), rename your repo folder lcoally and check out your repo again, then you can pull a diff to see if anything odd is missing/changed between the two repo folders.



回答12:

The thing that solved this issue for us was that we had moved our Git repos to a mapped network drive, thus changing the drive letter.

It seems that TortoiseGit needs to be set to monitor network drives - it is not the default behaviour.

So to solve this issue you would:

  • Right click a repo folder
  • Choose "TortoiseGit"
  • Choose "Settings"
  • Choose "Icon Overlays"
  • Tick "Network drives"

Job done.



回答13:

This might help... My drive letter was B: and the overlay icons would not update. I changed it to beyond C:, (I used M:) and it started working. Looks like TGIT does not drives below C:



回答14:

After getting astonished by this and trying pretty much everything, I managed to get it fixed by simply deleting one single file from the directory marked as modified, then reverting it from the TortoiseGit menu itself.

P.S. I made sure the CRC64 checksum for the entire directory was identical before and after this operation.