I have a repo with a submodule in it:
repo -
|
- repo_files
- submodule1
When developing code for repo, I often do
git fetch && git rebase origin/main && git submodule update --recursive --remote
to have the latest code in my branch. When I do that, I see things like
Submodule path 'submodule1': checked out '2950846955e7f122b222492476698458b54b65ca'
when code for the submodule has been modified in its own repo. And I do want the submodule to be up to date locally, for code navigation reasons etc.
However, by project convention, we do not push submodule version changes in parent repos to avoid cluttering the changelog and the hassle of maintaining parent repos updated (those changes are fetched by CI automatically).
What I want is to be able to run bulk staging, i.e. git add ., without adding the submodule version changes to my commits.
I tried following advice from this answer, but all it does is hiding submodule version changes from git status, while still adding those as a part of git add .. Adding submodule1 to .gitignore doesn't help either.
Is there a way to achieve behaviour that I require?