小工具知识网

当前位置: 首页 > 行业知识 > git重命名

行业知识

git重命名

2026-11-11 06:37:43 来源:互联网转载

mac和windows切换、多人协同开发时文件大小写命名问题,使用git重命名后:

()
mv oldfolder newfoldergit add newfoldergit remove oldfolder

It performs a file move, adds the new file to the index and removes the old file from it. We can see there’s no commit so we have to add the updates and commit the changes afterwards.

#git mv oldfolder newfoldergit mv -f oldfolder newfoldergit add -u newfoldergit commit -m "changed the foldername whaddup"

如下情况会出现报错:

()
git mv foldername folderName

If you’re using a case insensitive filesystem, e.g. you’re on a Mac and you didn’t configure it to be case sensitive, you’ll experience an error message like this one:
fatal: renaming ‘foldername’ failed: Invalid argument

解决如下:

git mv foldername tempname && git mv tempname folderName

参考:Rename files and folders with git

上一篇:监控配管服务器怎么连接?

下一篇:吃鸡更新怎么换服务器?