我认为它应该工作,复制目录要重命名到一个新的目录与所需的名称,并删除旧目录,git添加,git提交和推一切。但这是最好的方法吗?


当前回答

从Web应用程序我认为你不能,但是你可以重命名Git客户端的所有文件夹,它会把你的文件移动到新重命名的文件夹中,然后提交和推送到远程存储库。

我也遇到过类似的问题: 我不得不重命名不同的文件夹从大写到小写(像Abc -> Abc),我已经重命名了所有的文件夹与一个假的名字(像'abc___'),然后提交到远程存储库,之后我重命名所有的文件夹与小写的原始名称(像Abc),它采取了他们!

其他回答

只是提醒一下,除非您提供完整的文件夹路径,否则接受的答案将不起作用。否则,您将得到致命的:糟糕的源错误。

从Web应用程序我认为你不能,但是你可以重命名Git客户端的所有文件夹,它会把你的文件移动到新重命名的文件夹中,然后提交和推送到远程存储库。

我也遇到过类似的问题: 我不得不重命名不同的文件夹从大写到小写(像Abc -> Abc),我已经重命名了所有的文件夹与一个假的名字(像'abc___'),然后提交到远程存储库,之后我重命名所有的文件夹与小写的原始名称(像Abc),它采取了他们!

下面是重命名目录的示例。

git mv src/dir1/ src/dir2/

如果您得到一个声明权限被拒绝的错误,您可以尝试

git mv src/dir1 src/temp/
git mv src/temp src/dir2

在git中重命名是困难的,因为索引必须改变,并且树对象将在提交后创建。 我有重命名模板为模板的问题… 我用……解决了这个问题

copying Templates to templates in bash [cp -r Templates templates ] (git mv Templates templates will not work) removing Templates in bash [rm -r Templates ](check that the copying was successful first) Removing the Templates file from the index[use "git ls-files -s" to see the index, "git rm " you can use wildcards such as git rm Templates/*, continue checking the index] Adding the renamed paths to the index ("git add -v ." and check the result with "git ls-files -s" Commit ["git commit -m "renaming ... " If you have remotes git push <to wherever origin,

基本重命名(或移动):

git mv <old name> <new name>

区分大小写的重命名。从大小写敏感到大小写敏感-你必须使用两个步骤:

git mv casesensitive tmp
git mv tmp CaseSensitive

(更多关于Git中的大小写敏感性…)

…然后是commit和push,这是在git repo中重命名目录的最简单方法。