git的ignorecase对mv test Test
这样的操作有什么影响?
前置知识:
- 对文件名大小写不敏感,即我们可以创建两个文件,它们的名词除了大小写不一样外都一样,例如
test
和Test
- 对文件名大小写敏感则相反,即我们不能创建这样的两个文件
linux对文件名大小写敏感(touch text Text
是可行的),windows是对文件名大小写不敏感的。
看看在这两个设备上分别设置git config --local core.ignorecase false
,git config --local core.ignorecase true
对mv test Test
这样的操作有什么影响。
Linux
git init
echo "test" > test
git add test
mv test Test
ignorecase false
git config --local ignorecase false
git status
ignorecase true
git config --local ignorecase true
git status
这里为什么没有提示Test是未跟踪的呢?
windows(git bash)
git init
echo "test" > test
git add test
mv test Test
ignorecase false
git config --local ignorecase false
git status
ignorecase true
git config --local ignorecase true
git status
这里的提示信息显示就像没有执行过mv test Test
命令一样,为什么?
linux在该情况下,还输出了test deleted信息
造成这些差异的原因是什么?系统对文件的大小写是否敏感和git ignorecase的设置在其中又是如何影响的?