如何在 Git 中提交仅区分大小写的文件名更改? [英] How do I commit case-sensitive only filename changes in Git?
问题描述
我通过取消首字母大写来更改一些文件名,如Name.jpg
到name.jpg
.Git 无法识别此更改,我不得不删除文件并再次上传它们.在检查文件名更改时,有没有办法让 Git 区分大小写?我没有对文件本身进行任何更改.
I have changed a few files name by de-capitalize the first letter, as in Name.jpg
to name.jpg
. Git does not recognize this changes and I had to delete the files and upload them again. Is there a way that Git can be case-sensitive when checking for changes in file names? I have not made any changes to the file itself.
推荐答案
只要你只是重命名一个文件,而不是一个文件夹,你就可以使用 git mv:
As long as you're just renaming a file, and not a folder, you can just use git mv:
git mv -f yOuRfIlEnAmE yourfilename
(从 一项更改开始,-上面咒语中的 f
标志是多余的,但旧版 Git 需要它.)
(As of a change in Git 2.0.1, the -f
flag in the incantation above is superfluous, but it was needed in older Git versions.)
这篇关于如何在 Git 中提交仅区分大小写的文件名更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!