移动包含子模块的git存储库的父目录 [英] Moving the parent directory of a git repository that contains submodules

查看:166
本文介绍了移动包含子模块的git存储库的父目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将一个存储库克隆到PatchBasedInpaintingDevelop。我一直在那里工作一段时间没有问题。然后我决定在本地重命名文件夹。

  doriad @ daviddesktop:/ media / portable /我的目标是使用'mv PatchBasedInpaintingDevelop PatchBasedInpainting',现在git status抱怨子模块, Projects / PatchBasedInpainting $ git status 
fatal:不是git存储库:/media/portable/Projects/PatchBasedInpaintingDevelop/.git/modules/ITKQtHelpers

有没有办法在不打破子模块结构的情况下做这个动作?

解决方案

看来你的 .gitmodules 文件使用绝对路径引用子模块。



尝试对所述子模块使用相对路径。

(例如,在管理与Git相关的一组相关存储库

  submodule。< name> .path 




定义相对于git工作树的顶级目录的路径,该子模块应该在该路径中签出。

路径名不得以 /

所有子模块路径在 .gitmodules 文件中必须是唯一的。


唯一的解决方法是修复所有绝对路径(如此脚本


I had cloned a repository to PatchBasedInpaintingDevelop. I've been working in there for a while with no problems. Then I decided to rename the folder locally. I did 'mv PatchBasedInpaintingDevelop PatchBasedInpainting' and now git status complains about submodules, saying:

doriad@daviddesktop:/media/portable/Projects/PatchBasedInpainting$ git status
fatal: Not a git repository: /media/portable/Projects/PatchBasedInpaintingDevelop/.git/modules/ITKQtHelpers

Is there a way to do this move without breaking the submodule structure?

解决方案

It seems your .gitmodules file reference the submodules using an absolute path.

Try using a relative path for said submodules.
(as shown, for instance, in "Managing a set of related repositories relative in Git")

submodule.<name>.path

Defines the path, relative to the top-level directory of the git working tree, where the submodule is expected to be checked out.
The path name must not end with a /.
All submodule paths must be unique within the .gitmodules file.

The only other solution is to fix all the absolute paths (as in this script)

这篇关于移动包含子模块的git存储库的父目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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