This is a known issue in TortoiseGit. It has existed for years and, apparently, will never be fixed. I do not know if this is so because the TortoiseGit developer does not want or cannot do this. (I also reported this before, but I can no longer find the problem now.)
Anyway, here is what I do to solve this:
git gc --prune=all --quiet
It shrinks the Git repository, repacks all of these individual object files, reduces the number of files in .git from tens of thousands to 20, and possibly improves the overall performance of Git operations.
Git sometimes makes a lighter version of this after a commit, but I have rarely seen it happen over the years of daily use. So I just do it myself. This is also a great action to consider before backing up your system (see below).
To make this easier, I created the git-gcall.cmd batch file in an accessible path that calls the command shown above. I have to run it after almost every commit, and after 2-3 seconds the icons are updated. The killings are not related. Just waking up TortoiseGit is a little harder to really monitor the repository and update its state.
Here's a PowerShell script that runs this command in a set of configured directories recursively, if necessary, for use before creating a backup. It can also be run on a regular basis, for example at night, to solve this outdated icon problem in the background.
ds-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
Name it using the usual required accompanying file:
ds-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%
ygoe Jan 26 '19 at 12:01 2019-01-26 12:01
source share