移动包含子模块的git存储库的父目录 [英] Moving the parent directory of a git repository that contains submodules
问题描述
我已经将一个存储库克隆到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工作树的顶级目录的路径,该子模块应该在该路径中签出。 唯一的解决方法是修复所有绝对路径(如此脚本) 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: Is there a way to do this move without breaking the submodule structure? It seems your Try using a relative path for said submodules.
Defines the path, relative to the top-level directory of the git working tree, where the submodule is expected to be checked out. The only other solution is to fix all the absolute paths (as in this script) 这篇关于移动包含子模块的git存储库的父目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
路径名不得以 /
。
所有子模块路径在 .gitmodules
文件中必须是唯一的。
doriad@daviddesktop:/media/portable/Projects/PatchBasedInpainting$ git status
fatal: Not a git repository: /media/portable/Projects/PatchBasedInpaintingDevelop/.git/modules/ITKQtHelpers
.gitmodules
file reference the submodules using an absolute path.
(as shown, for instance, in "Managing a set of related repositories relative in Git")submodule.<name>.path
The path name must not end with a /
.
All submodule paths must be unique within the .gitmodules
file.