I'm very confused about git-submodules.
Basically my problem is that I can't make git understand that ~/main-project/submodule is a submodule.
I have good experience with git submodules:
in my dotfiles repository I created the .gitmodules file in ~/dotfiles-repo and I added there paths and urls. Since then, If I make changes to the files within the submodules and run git status, I'd get something like like: .vim/bundle/auto-complete (new commits) # in red
I created the .gitmodules file in ~/main-project but:
- If I make changes to
~/main-project/submoduleand even push the changes, I don't get a similar response like<submodule> (new commits) # in redwhen runninggit statusin~/main-project. I just get the changes that were made in those directories When I hit the folders' links at
githubfor these directories it's not directing me to the repositories themselves but I stay in the same repository.- Maybe I'm missing the whole point. What are the main features of submodules?
- Why does git understands the submodules in the dotfiles repo but not in my other repo?
- Is it because I have already told git to add the files inside
~/main-project/submoduleto the index?
I've read this question which led me to this answer But I'm not sure I need git-subtree. I don't want to do things that might do changes hard to be revert.
Edit: This suggested duplicate-solution didn't work either, I recieved an error that
Updates were rejected because the remote contains work that you do not have locally. It seems that @GabLeRoux practically told me to push<repo-A>to the url of<repo-B>.