Prevent updating git submodule commit
Answered
I am using submodules for one of my projects. It works great and I like that I can point all repos to the same branch, but there is one thing that bothers me every time. After each commit to the submodule, the commit id in the main repo is updated. Is there any way to prevent this behavior? I want to update commit only when I create a new release of my product, not on every commit.
Please sign in to leave a comment.
Could you please provide a bit more details.
Do you sue git submodules (with the appropriate git command), or you just mean some module of your project?
And what do you mean commit ID is updated? Commit hash changes? Something else?
A screenshot is appreciated.
I am using proper git submodules. Every time I commit something to my submodule, I get something like this:
As far as I understand, it means that commit hash of the submodule is updated in the main repository. I want to avoid updating it with every commit to submodule.
This is the expected behavior of git-submodules.
In the main repo a submodule is represented as a particular commit from the appropriate repository
See official docs for details
https://git-scm.com/book/en/v2/Git-Tools-Submodules
Thanks. I have found a way to ignore changes to submodule. I have added following line for the submodule config:
ignore = allI just add here that Anton is right, if you want to stop generating those submodule hashes, add to your .git/config