I have a git repository say 'starter kit' and another git repository inside it. After I make changes to submodule I want to push it to 'starter kit' and do nothing to submodule. How can I get this. Git wont allow me to do this. It says error: exit code 1 received when I try to commit.
Steps I followed.
~ git clone <starter-kit-git-url>
~ cd app/themes/
~ git clone <submodule-git-url>
~ cd ../.. (go back to root folder)
~ git submodule add <submodule-git-url> app/themes/submodule/
Adding existing repo at 'site/web/app/themes/submodule' to the index
made changes to a file in submodule.
~git status
modified: site/web/app/themes/submodule (modified content)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitmodules
no changes added to commit (use "git add" and/or "git commit -a")
Now I am unable to commit the submodule/ to parent repository ie 'starter kit' How to commit the changes to my repository only? When I try to commit them using github desktop it says "commit failed - exit code 1 received"
git submodule add
clones the submodule for you, you don't have to git clone
the submodule before. After that, the first thing you should do is commit the adding of the submodule to your parent repository (starter-kit
); the commit will add the .gitmodules file and the submodule directory to your repository.
Then, after you made changes in the submodule, you have to commit them inside the submodule, and after that have to commit the changes in the parent repository, since the commit the parent repository is pointing to has changed. You need to commit in both repositories every time you do a relevant change in the submodule.
It's unclear what you mean by
Now I am unable to commit the submodule/ to parent repository
If my rather general explanation did not fix your issue, please elaborate further on what excactly you tried to commit in your parent repository.