git TortoiseGit 修改后的标志(图标覆盖)未更新
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8137929/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
TortoiseGit modified sign (icon overlay) is not updating
提问by Booksman
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.
我在一些代码中做了一个小改动,但 TortoiseGit 将它显示为已修改(红色感叹号),尽管我已经提交、拉取、推送,但它仍然存在。我应该在这里做什么?我以前没有见过这个问题。
回答by Andy
I'm assuming you are using tortoise git? I've had the issue before, sometimes pressing F5fixes it other times it just goes away after tortoise resyncs itself.
我假设您正在使用乌龟 git?我以前遇到过这个问题,有时按F5修复它,有时它会在乌龟重新同步后消失。
Here is another possible fix link.
这是另一个可能的修复链接。
The current workaround is to kill TGitCache.exe with the Windows task manager.
当前的解决方法是使用 Windows 任务管理器终止 TGitCache.exe。
回答by neutcomp
What helped for me was the following:
对我有帮助的是以下内容:
- Go to "Settings -> Icon Overlays" Check under "Status cache" the option "none"
- Refresh the explorer F5
- Go back and change the cache option back to "Default"
- 转到“设置->图标覆盖”检查“状态缓存”下的选项“无”
- 刷新资源管理器 F5
- 返回并将缓存选项更改回“默认”
回答by Mike Gibson
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.
Kill TGitCache.exe 对我有用。.... 我把它作为答案,因为我没有足够的声望点来添加它作为评论。但想帮助进一步迭代它是一个有效的解决方案。
回答by meJustAndrew
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: MyComplexProjectcan be changed to MyComplexProject1then back to MyComplexProject.
例如:MyComplexProject可以更改为MyComplexProject1然后再回到MyComplexProject。
回答by manojlds
Apart from what @Andy mentioned, you can make the overlays work faster by limiting the folders that it has to monitor.
除了@Andy 提到的内容之外,您还可以通过限制必须监视的文件夹来使叠加层更快地工作。
Right click-> TortoiseGit -> Settings -> Icon Overlays
右键单击 -> TortoiseGit -> 设置 -> 图标叠加
Here enter include and exclude paths. I usually explicitly point to the my repos / working copies:
在此输入包含和排除路径。我通常明确指出我的回购/工作副本:
回答by Adam Dymitruk
Please check your path to see if it matches in case.
请检查您的路径以查看它是否匹配以防万一。
Some/Dir/SomeFile.ext
is the same to windows as
与 windows 相同
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.
但是对于 Git 来说,它们位于不同的位置。这可以通过使用适当的外壳从顶部导航回来来解决。
回答by Simon East
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.
缓存进程应该自动重新启动。如果您注意到它经常发生,您甚至可以将其转换为桌面快捷方式。
回答by Matthijs de Ridder
I had the same issue at Windows.
我在 Windows 上遇到了同样的问题。
Killing TGitCache did work for a couple of seconds but the red icon appeared again.
杀死 TGitCache 确实工作了几秒钟,但红色图标再次出现。
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.
原来文件在本地被重命名(第一个字母从大写变为小写),但在 Git 中没有改变。Windows 不区分大小写,但 Git 是!所以图标覆盖不再匹配。我确实通过删除特定文件并从 Turtoise Git 上下文菜单中选择“恢复”来发现这一点。在列表中,确实出现了两个文件,一个第一个字母大写,另一个完全小写。
Finally renaming the file from the Git context menu did resolve the issue for me.
最后从 Git 上下文菜单重命名文件确实解决了我的问题。
回答by ygoe
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.)
这是 TortoiseGit 中的一个已知问题。它存在多年,显然永远不会被修复。不知道是不是因为 TortoiseGit 开发者不愿意或者做不到。(我之前也报告过,但现在找不到问题了。)
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.
它修剪 Git 存储库,重新打包所有这些单个对象文件,将文件数量.git
从数万个减少到 20 个以下,并可能提高 Git 操作的整体性能。
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).
有时,Git 在提交后会自己做一个轻量级的版本,但我在多年的日常使用中很少看到这种情况发生。所以我只好自己做。这也是在备份系统之前需要考虑的一个很好的操作(见下文)。
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.
为方便起见,我在git-gcall.cmd
调用上述命令的可访问路径中创建了一个批处理文件。我必须在几乎每次提交后运行它,并且在 2-3 秒后图标会自行更新。不涉及杀戮。只是唤醒 TortoiseGit 更难实际观察存储库并更新其状态。
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.
这是一个 PowerShell 脚本,它在一组配置的目录中递归运行此命令,如有必要,在进行备份之前使用。它也可以定期运行,例如通宵运行,以在后台解决这个过时的图标问题。
gc-all-git.ps1:
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:
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%
回答by UKcentric
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.
为我们解决了这个问题的是我们将 Git 存储库移动到映射的网络驱动器,从而更改了驱动器号。
It seems that TortoiseGit needs to be set to monitor network drives - it is not the default behaviour.
TortoiseGit 似乎需要设置为监视网络驱动器 - 这不是默认行为。
So to solve this issue you would:
因此,要解决此问题,您将:
- Right click a repo folder
- Choose "TortoiseGit"
- Choose "Settings"
- Choose "Icon Overlays"
- Tick "Network drives"
- 右键单击一个 repo 文件夹
- 选择“TortoiseGit”
- 选择“设置”
- 选择“图标叠加”
- 勾选“网络驱动器”
Job done.
任务完成。