【问题标题】:rename Folder in Origin在 Origin 中重命名文件夹
【发布时间】:2013-07-04 22:51:10
【问题描述】:

我有一个带有 Components 文件夹的 git 存储库。此文件夹已重命名为 components,但由于该文件夹已在存储库中,因此不会在原始存储库中重命名。

如何重命名源存储库中的文件夹?

【问题讨论】:

  • 你的意思是远程仓库?只需提交更改,即git mv Components components,然后git commit 并将更改推送到远程存储库。
  • 如果您在 Windows 上请小心,因为 Windows 将文件和文件夹名称视为不区分大小写,而 Unix 区分大小写。不知道在 Windows 的情况下会发生什么。
  • @Cupcake 在 Windows 上,您会对大小写更改感到不满,就像权限更改和仅大小写不同的文件一样。在 linux 上,它应该是不费吹灰之力的(简单的删除 + 添加新名称)。不过,op 并没有告诉我们他使用的是什么系统。

标签: git directory rename


【解决方案1】:
git mv <old name> <new name>
git commit "Componetens -> components"
git push

【讨论】:

    【解决方案2】:

    如果您已经重命名了您的文件夹,而不告诉 git(通过正确的git mv),您可以

    git delete Components
    git add components
    git commit -m "rename Components folder to components"
    git push
    

    陷阱是添加到索引第二个文件夹“components”,像 Windows 这样不区分大小写的操作系统很难显示,因为它无法检查输出“Components”和“components”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-09
      • 2012-03-25
      • 2011-12-30
      • 1970-01-01
      • 1970-01-01
      • 2014-04-04
      • 1970-01-01
      • 2018-08-01
      相关资源
      最近更新 更多