Toby
Toby

Reputation: 10144

Is it possible to update a submodule SHA without pulling?

I have a repo on local that has a reference to a submodule. I would like to update the SHA referenced by the submodule to a more recent one.

The change is only to allow the CICD pipelines that run on the remote to pull in the latest submodule when building everything. I do not need, nor want, this submodule's contents locally.

Is there some way I can update the submodule's reference to a more recent SHA without pulling the submodule's contents from the remote?

Happy enough to even try editing git files to avoid pulling but I have not been able to find out where this reference is actually stored.

Upvotes: 1

Views: 218

Answers (1)

jthill
jthill

Reputation: 60275

There's a core command to set index entries directly.

git update-index --cacheinfo 160000,<new_SHA_here>,path

sets the entry for path to that commit, exactly as if you'd git added a submodule's checkout of that commit.

Upvotes: 1

Related Questions