Answer the question
In order to leave comments, you need to log in
Git. Working with submodules from the main project directory?
Hello.
We have a project from which we decided to separate a part into a submodule.
All shared, all is well. The structure is something like this:
/www/project/
/www/project/submodule/
/www/submodule/
If you edit the submodule from /www/submodule/ then everything is fine. Changes are made, in the main project git submodule update hooks everything up, etc.
But if you enter /www/project/submodule/ and make edits from there, then no changes are made to the submodule. For example, during git push it says "Already up-to-date", or that you need to do a git pull first, but when you do it, again "Already up-to-date".
In our opinion, the scheme should be something like this:
Go to /www/project/submodule/ Make
changes to the submodule.
We push the changes to the submodule.
We go to the root of the project.
We do git submodule update
We do commit/push in the main project.
Profit!
Most likely, we misunderstood something, but I would like to understand and work normally with submodules.
Please tell me what are we doing wrong?
Is it ok to work with a submodule from the main project directory? And why are there problems?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
As far as I remember, when creating a submodule, HEAD refers not to a branch, but to a specific commit.
Try:
cd /www/project/submodule/
git checkout master
git commit
git push -u origin master
cd /www/project
git add submodule
git commit submodule -m "Updated submodule"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question