在Git中重命名文件

在Git中重命名文件,git,Git,我在Git中有一个名为100\u Test\u Customer\u Team\u abc.txt的文件,它已被推送到远程存储库。我在名称上犯了一个错误-团队应该用大写字母,因此我想将其重命名为100\u Test\u Customer\u team\u ABC.txt 我使用了: git mv 100_Test_Customer_Team_abc.txt 100_Test_Customer_Team_ABC.txt 但我得到了以下错误: 致命:目标存在 如何重命名它?您可以尝试以下解决方案:

我在Git中有一个名为
100\u Test\u Customer\u Team\u abc.txt
的文件,它已被推送到远程存储库。我在名称上犯了一个错误-团队应该用大写字母,因此我想将其重命名为
100\u Test\u Customer\u team\u ABC.txt

我使用了:

git mv 100_Test_Customer_Team_abc.txt 100_Test_Customer_Team_ABC.txt
但我得到了以下错误:

致命:目标存在


如何重命名它?

您可以尝试以下解决方案:

 git mv --force 100_Test_Customer_Team_abc.txt 100_Test_Customer_Team_ABC.txt

使用mv命令移动它:

mv 100_Test_Customer_Team_abc.txt 100_Test_Customer_Team_ABC.txt
由于您使用的是Windows,因此只需通过重命名文件即可

然后将所有更改添加为跟踪更改:
git add-A
。然后,您将看到Git在
Git状态中跟踪已删除/添加为重命名的


现在,您可以简单地
git commit-m'重命名文件'
并推送到远程。

文件系统区分大小写吗?重置头部并重新添加文件到Windows操作系统
git mv 100_Test\u Customer\u Team\u abc.txt tmp和&git mv tmp 100_Test\u Customer\u Team\u abc.txt,也许吧。