I have a super repo and a few submodules in this repo:
MY_SUPER_REPO
Now I am creating a new directory that will later become a submodule:
When I am ready for it to become a sub repo I do:
git init
git remote add origin URL
I then go to the super repo and
git submodule add URL
Now .gitmodules
are updated accordingly BUT the .git
directory stays in the my_dir_3
and the hooks seems to be taken from here when I work in that sub module, not from the super repo .git/modules/xyz
directory. I run a script to copy hooks to .git/modules/xyz
in my super repo but since the local .git
folder exists in the added sub module the hooks in the super repo aren't used.
Is there any "magic" command to fix this or do I need to copy .git
manually?
You could slightly change your process and:
git remote add origin URL
), you would first push that new repo to its remote destinationgit submodule add URL
)That way, you are sure the submodule is correctly initialized, with its .git located at the right spot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With