3

I have a submodule in my repo with a .git file that has just one line

gitdir: ../.git/modules/mysubmodule

However, 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/.git

And 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?

user3637203
  • 762
  • 5
  • 17

1 Answers1

1

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

phd
  • 82,685
  • 13
  • 120
  • 165