git的ignorecase对`mv test Test`这样的操作有什么影响?

git的ignorecase对mv test Test这样的操作有什么影响?

前置知识:

  • 对文件名大小写不敏感,即我们可以创建两个文件,它们的名词除了大小写不一样外都一样,例如testTest
  • 对文件名大小写敏感则相反,即我们不能创建这样的两个文件

linux对文件名大小写敏感(touch text Text是可行的),windows是对文件名大小写不敏感的。
看看在这两个设备上分别设置git config --local core.ignorecase falsegit config --local core.ignorecase truemv test Test这样的操作有什么影响。

Linux

git init
echo "test" > test
git add test
mv test Test

ignorecase false

git config --local ignorecase false
git status

image.png

ignorecase true

git config --local ignorecase true
git status

image.png

这里为什么没有提示Test是未跟踪的呢?

windows(git bash)

git init
echo "test" > test
git add test
mv test Test

ignorecase false

git config --local ignorecase false
git status

image.png

ignorecase true

git config --local ignorecase true
git status

image.png

这里的提示信息显示就像没有执行过mv test Test命令一样,为什么?
linux在该情况下,还输出了test deleted信息

造成这些差异的原因是什么?系统对文件的大小写是否敏感和git ignorecase的设置在其中又是如何影响的?

阅读 561
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题