我有一个 Windows 和 linux 共享的磁盘分区(格式:NTFS)。它包含一个 git 存储库(大约 6.7G)。
如果我只使用 windows或只使用 linux来操作 git 存储库,一切都可以。
但是每次我切换系统。该git status
命令将刷新索引,大约需要 1 分钟。运行后git status
,如果我git status
再次在同一系统中运行。只需不到 1 秒。这是结果
# Just after switch from windows
[#5#wangx@manjaro:duishang_design] git status # this command takes more than 60s
Refresh index: 100% (2751/2751), done.
On branch master
nothing to commit, working tree clean
[#10#wangx@manjaro:duishang_design] git status # this time the command takes less than 1s
On branch master
nothing to commit, working tree clean
[#11#wangx@manjaro:duishang_design] git status # this time the command takes less than 1s
On branch master
nothing to commit, working tree clean
我想git缓存有一些问题。例如:windows和linux都使用该.git/index
文件作为缓存文件,但是linux系统中的git无法识别.git/index
windows更改的内容。所以只能刷新索引和替换.git/index
文件,这使得nextgit status
超级快,git status
在windows下很慢(因为windows系统会再次刷新索引文件)。
我的猜测正确吗?如果是这样,我如何使用为不同的系统设置索引文件?我该如何解决这个问题?