在Git中更改文件名的大小写 [英] Changing capitalization of filenames in Git

查看:1197
本文介绍了在Git中更改文件名的大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git mv src / collision / b2AABB.js src / collision / B2AABB.js 
fatal:destination exists,source = src / collision / b2AABB.js,destination = src / collision / B2AABB.js

正如你所看到的,git抛出了这个问题。我尝试使用简单的旧的 mv 命令进行重命名,但git没有选择重命名(作为重命名作为新的未跟踪文件)。



如何将文件更改为具有相同名称的不同大小写?我在Mac OS X 10.7.3上使用git 1.7.9.1使用zsh 4.3.15。

解决方案

启动git 2.0.1 (2014年6月25日), git mv 仅适用于不区分大小写的操作系统。



请参阅提交baa37bf > David Turner( dturner-tw



mv :允许重命名修改不区分大小写的文件系统的情况



git mv hello.txt Hello.txt 在不区分大小写的文件系统上始终触发目标已存在错误,因为这两个名称是从文件系统的角度引用相同的路径,并且要求用户在更正记录在索引和下一次提交中的路径时,给出 - force


检测这种情况并允许它不需要 - force


git mv hello.txt Hello.txt 正常工作(不再需要 - force )。


I am trying to rename a file to have different capitalization from what it had before:

git mv src/collision/b2AABB.js src/collision/B2AABB.js
fatal: destination exists, source=src/collision/b2AABB.js, destination=src/collision/B2AABB.js

As you can see, git throws a fit over this. I tried renaming using just the plain old mv command as well but git doesn't pick up the rename (as a rename or as a new untracked file).

How can I change a file to have a different capitalization of the same name? I am on Mac OS X 10.7.3 with git 1.7.9.1 using zsh 4.3.15.

解决方案

Starting git 2.0.1 (June 25th, 2014), a git mv will just work on case insensitive OS.

See commit baa37bf by David Turner (dturner-tw)

mv: allow renaming to fix case on case insensitive filesystems

"git mv hello.txt Hello.txt" on a case insensitive filesystem always triggers "destination already exists" error, because these two names refer to the same path from the filesystem's point of view, and requires the user to give "--force" when correcting the case of the path recorded in the index and in the next commit.

Detect this case and allow it without requiring "--force".

git mv hello.txt Hello.txt just works (no --force required anymore).

这篇关于在Git中更改文件名的大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆