简体   繁体   English

我的 git 存储库更改不断标记为假定未更改

[英]My git repository changes are constantly flagged as assume-unchanged

I've been using git on windows for years without any major issue.多年来,我一直在 windows 上使用 git,没有出现任何重大问题。 However, it's been some time now that I believe I have something that tempers with my local git repositories and from time to time flags my modified files as assume-unchanged to the point I have an alias that runs all my repo files and update-index --really-refresh --no-assume-unchanged each and every one of them, and I use it nearly before every git status .然而,现在已经有一段时间了,我相信我的本地 git 存储库有一些缓和的东西,并且不时将我修改的文件标记为假设未更改,以至于我有一个别名来运行我的所有回购文件和update-index --really-refresh --no-assume-unchanged每一个,我几乎在每个git status之前都使用它。 But this is no way to live: :P但这不是生活的方式::P

I had removed ConEmu from my machine in hope this might help, but didn't get any results (mind, I should probably restart my machine before).我已经从我的机器上删除了 ConEmu,希望这会有所帮助,但没有得到任何结果(请注意,我可能应该先重新启动我的机器)。 I doubt VS code has anything to do with it.我怀疑 VS 代码与它有什么关系。 I'm at lost tbh.我迷路了。 Is there any git config value that may cause this?是否有任何 git 配置值可能导致此问题?

Has anyone experienced a similar issue and found the evil forces that are behind this Machiavellian mechanism?有没有人经历过类似的问题并发现了这种马基雅维利机制背后的邪恶力量? I wish to name and shame it throughout the universe...我想在整个宇宙中命名和羞辱它......

Seriously though, any help would be highly appreciated.不过说真的,我们将不胜感激任何帮助。

From your comment: something (some script or some other process) is setting the assume-unchanged flag on each of your files.根据您的评论:某些东西(一些脚本或其他一些过程)正在为您的每个文件设置assume-unchanged标志。

You may look into your .git/hooks directory (also check git config core.hooksPath to see if you have a custom hooks directory configured), or some other script/task that would pass on all the files in your repo.您可以查看您的.git/hooks目录(也检查git config core.hooksPath以查看您是否配置了自定义 hooks 目录),或其他一些将传递您的 repo 中所有文件的脚本/任务。

If you really don't have a clue about what might be causing this: use grep -e "assume-unchanged" -r.如果您真的不知道可能导致此问题的原因:使用grep -e "assume-unchanged" -r. (to try to spot a script which would run update-index --assume-unchanged ), first in your repo, then in your home dir, in last resort from / ... (尝试发现一个将运行update-index --assume-unchanged的脚本),首先在您的 repo 中,然后在您的主目录中,最后从/ ...

Ok, so after messing around with vs code, resharper and sublime text (uninstalling everything, deleting leftovers, restarting the machine and so on)- nothing was coming up as the reason behind this weird behaviour.好的,所以在弄乱了 vs 代码、resharper 和 sublime 文本(卸载所有内容、删除剩余部分、重新启动机器等等)之后——没有任何东西可以作为这种奇怪行为背后的原因。

And then I commented out all of my gitconfig file- and the behaviour was gone.然后我注释掉了我所有的 gitconfig 文件-并且行为消失了。 It then took me no time to figure out the reason behind this behaviour was the following configuration that was set to true:然后我很快就弄清楚了这种行为背后的原因是以下配置设置为 true:

core.ignoreStat

I have no idea how and when did it sneak into my gitconfig file and got set to true, but hopefully this will help others who may experience this.我不知道它是如何以及何时潜入我的 gitconfig 文件并设置为 true 的,但希望这将有助于其他可能遇到这种情况的人。

I had a similar problem, but on Linux. The answer from OP about git config didn't work for me but got me looking in the right direction.我有一个类似的问题,但在 Linux 上。OP 关于 git 配置的答案对我不起作用,但让我找到了正确的方向。

The git config option core.fsmonitor was set to true (carried over from my Windows config where this was an experimental option that improved performance). git 配置选项core.fsmonitor设置为 true(从我的 Windows 配置中继承,这是一个提高性能的实验性选项)。 On my Linux system, this causes basically no file system changes to be detected by git. Now that I've removed it, everything works just fine.在我的 Linux 系统上,这导致 git 基本上检测不到任何文件系统更改。现在我已经删除它,一切正常。

Hope this helps someone else with the same issue.希望这可以帮助其他人解决同样的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM