Tuesday, 6 August 2013

Is itn possible to force git submodules to be updated?

Is itn possible to force git submodules to be updated?

We have a git repository that depends on code in other git repositories.
We use submodules, the usual way, to express this relationship and ensure
that the supporting code lives at a standard location within the user's
directory structure. Updating the supporting code is straightforward
enough:
make a change to a submodule
commit it
push it
cd into the main repository
commit the change to the submodule
push it
The problem comes on the other side. After this sort of change, for other
developers to get a complete, consistent set of code they need to execute
three commands:
git pull (update the main repository)
git submodule init (in case any new submodules were added)
git submodule update (update the submodules)
It's proven difficult to train developers to do all of these, particularly
since in all of our other repositories, which don't contain submodules,
the pull is sufficient. The result is developers at times working with
code that uses obsolete versions of the submodules, resulting in spurious
problems that can be time-consuming to track down. It there any way, other
than writing a shell script that does all three commands and insisting
"Use this!", to make this more automatic?

No comments:

Post a Comment