如何让git忽略大小写变化?

编程入门 行业动态 更新时间:2024-10-09 03:21:02
本文介绍了如何让git忽略大小写变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不太确定这里发生了什么,但有时候我的存储库中的某个特定文件会改变它的名称。例如:

之前: File.h

after: file.h

我不在乎为什么会发生这种情况,但这会导致git认为它是一个新文件,然后我必须去改变文件名。你可以让git忽略大小写变化吗? $ p $ b我怀疑这是Visual Studio在特定情况下做了些奇怪的事情文件,因为它在更改后打开并保存时似乎最常发生。我没有任何方法可以修复VS中的错误,但是git应该更有能力,我希望。

解决方案

从版本1.5.6开始,在的 [core] 部分有一个 ignorecase .git / config

例如添加 ignorecase = true

若要将其更改为仅一个回购,请从该文件夹运行:

git config core.ignorecase true

全局更改:

git config --global core.ignorecase true

I'm not too sure what is going on here, but sometimes a particular file in my repository will change the case of it's name. e.g.,:

before: File.h

after: file.h

I don't really care why this is happening, but this causes git to think it is a new file, and then I have to go and change the file name back. Can you just make git ignore case changes?

[edit] I suspect it is Visual Studio doing something weird with that particular file, because it seems to happen most often when I open and save it after changes. I don't have any way to fix bugs in VS however, but git should be a bit more capable I hope.

解决方案

Since version 1.5.6 there is an ignorecase option available in the [core] section of .git/config

e.g. add ignorecase = true

To change it for just one repo, from that folder run:

git config core.ignorecase true

To change it globally:

git config --global core.ignorecase true

更多推荐

如何让git忽略大小写变化?

本文发布于:2023-11-11 08:29:33,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:大小写   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!