git submodule, ignoring the wrong directory
I am new to git but have spent a good deal of time reading through documentation and gotchas on git submodules before trying them. I am having a problem that I feel -- probably naively -- is a bug in git:
I have a project, in that root directory I have a plugins folder, which has a submodule called myplugin. I added it with
git submodule add xxxxxgithub.com/me/myplugin.git plugins/myplugin
which worked great. Everything has been working fine for about a week. The framework I'm using has support for overriding views that are inside a plugin. Those must be stored in
views/plugins/myplugin/customviewfile.
The problem is, git thinks that the override folder is also at:
plugins/myplugin
Git won't commit anything inside of my views/plugins/myplugin directory, it won't track the files, I can't unignore it no matter what I do. In Github it shows up with the green arrow indicating that it's a submodule and when I switch branches that directory carries over the way submodules do
I have been pulling my hair out for over an hour and making no progress... any help is greatly appreciated!
Most of what you need to know about the way you work with submodules is summarize here.
Did you add the submodule directly in views? And if yes, what the views/.gitmodules
contain?
When you added it, did you also commit in your main project (just above plugins)?
But if views is another clone of your repo, where you expect to see plugins/myplugin
submodules, did you:
git submodules init
git sumodules update
?
The OP adds: the actual issue was plugins
directory, at one point, was ignored (rm and then added to .gitignore
file), making any submodules undetectable.
I take it back... it was me, apparently one time I must have committed the actual plugins in that folder somehow (maybe moving folders around accidentally) I don't remember doing it.. but anyhow I found it in github history of commits. I git rm -rf'ed the views/plugins directory and now it's working
精彩评论