我的repo中有一个子模块,只有一行.git文件
gitdir: ../.git/modules/mysubmodule但是,gitlab的CI运行程序似乎有这个gitdir语句的问题,所以我想将../.git/modules/mysubmodule移动到./mysubmodule/.git 。
我使用mv做了这个我没有使用git mv ,因为这个命令抱怨
fatal: cannot move directory over file, source=.git/modules/mysubmodule, destination=mysubmodule/.git我还从mysubmodule/.git/config文件中删除了worktree行。
但是,当我想提交更改时(无论是超级项目还是子模块),git都没有列出提交更改。
这就是为什么我想知道如何将gitdir移动到另一条路径?
I have a submodule in my repo with a .git file that has just one line
gitdir: ../.git/modules/mysubmoduleHowever, the CI runner of gitlab seems to have problems with this gitdir statement, so I want to move ../.git/modules/mysubmodule to ./mysubmodule/.git.
I did this using mv I did not use git mv, because this command complains with
fatal: cannot move directory over file, source=.git/modules/mysubmodule, destination=mysubmodule/.gitAnd I also removed the worktree line from the mysubmodule/.git/config file.
However, when I want to commit the changes (either to the superproject or the submodule), git lists no changes to commit.
This is why I am wondering how can I move the gitdir to another path?
最满意答案
在./mysubmodule/.git看到.git git仍然认为mysubmodule是一个子模块,并没有将它显示为superrepo的一部分。
如果你想删除子模块并直接重新添加它们,你应该删除子模块,并在没有.git子目录的情况.git添加子模块 。
或者从git submodule切换到git subtree 。 请参阅https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt和https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844
Seeing .git in ./mysubmodule/.git git still thinks mysubmodule as a submodule and doesn't show it as a part of superrepo.
If you want to remove submodule(s) and re-add them directly yoy should remove submodules and add them without .git subdirectory.
Or switch from git submodule to git subtree. See https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt and https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844
将子模块的gitdir迁移到'in-tree'(Migrating a submodule's gitdir to 'in-tree')我的repo中有一个子模块,只有一行.git文件
gitdir: ../.git/modules/mysubmodule但是,gitlab的CI运行程序似乎有这个gitdir语句的问题,所以我想将../.git/modules/mysubmodule移动到./mysubmodule/.git 。
我使用mv做了这个我没有使用git mv ,因为这个命令抱怨
fatal: cannot move directory over file, source=.git/modules/mysubmodule, destination=mysubmodule/.git我还从mysubmodule/.git/config文件中删除了worktree行。
但是,当我想提交更改时(无论是超级项目还是子模块),git都没有列出提交更改。
这就是为什么我想知道如何将gitdir移动到另一条路径?
I have a submodule in my repo with a .git file that has just one line
gitdir: ../.git/modules/mysubmoduleHowever, the CI runner of gitlab seems to have problems with this gitdir statement, so I want to move ../.git/modules/mysubmodule to ./mysubmodule/.git.
I did this using mv I did not use git mv, because this command complains with
fatal: cannot move directory over file, source=.git/modules/mysubmodule, destination=mysubmodule/.gitAnd I also removed the worktree line from the mysubmodule/.git/config file.
However, when I want to commit the changes (either to the superproject or the submodule), git lists no changes to commit.
This is why I am wondering how can I move the gitdir to another path?
最满意答案
在./mysubmodule/.git看到.git git仍然认为mysubmodule是一个子模块,并没有将它显示为superrepo的一部分。
如果你想删除子模块并直接重新添加它们,你应该删除子模块,并在没有.git子目录的情况.git添加子模块 。
或者从git submodule切换到git subtree 。 请参阅https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt和https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844
Seeing .git in ./mysubmodule/.git git still thinks mysubmodule as a submodule and doesn't show it as a part of superrepo.
If you want to remove submodule(s) and re-add them directly yoy should remove submodules and add them without .git subdirectory.
Or switch from git submodule to git subtree. See https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt and https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844
发布评论