We now assume, that the external plugin is updated by its own repository only and no customization is needed. Upgrading your submodules via the superproject In other words, you may use git submodule update -init in the case you forget the -recursive option in your git clone command. Instead of changing the moodle directory and use git submodule update -init after the clone, you can use git clone with the -recursive option as well. There is a shorter command to initialize the submodules, but the outcome will be the same as above. No changes added to commit (use "git add" and/or "git commit -a") # modified: mod/mylittleextension (new commits) " to discard changes in working directory) Nothing to commit (working directory clean)īranch dev set up to track remote branch dev from origin. Mod/mylittleextension $ git checkout master a checkout of the branch master won't be noticed by the main repository, but a checkout of dev will: This means also, that everyone can switch branches unnoticedly as long as the HEAD's hash reference doesn't change.Į.g. You and your developers need to keep in mind, that any change of the HEAD's reference of your submodule will be noticed by the main repository. This means, git submodule update -init will first do a clone of source url into the path and then check out the reference, leaving the submodule in detached HEAD state. See this figure, for a better understanding:ĭotted line: information obtained from the superproject, but already saved locally (by pull) This is due the fact, that Git receives following data from the superproject: The -recursive option means, that Git will walk through nested submodules as well (not obligatory in this example).Īfter the initialization the submodule's repository will be in detached HEAD state. The new main repositories will automatically know about the new extension, but it won't be initialized, which means that the submodule's directory will be empty in the beginning.įor initializing the submodule, the developer needs to execute git submodule update -init -recursive. Remotes/origin/master 89d9eae Initial commit Submodule 'mod/mylittleextension' (/local/repositories/mle) registered for path 'mod/mylittleextension' Now a developer has to type in the following commands, in order to clone the superproject (maybe from a remote device). $ git commit -a -m "New module MLE installed" $ git submodule add /local/repositories/mle/ mod/mylittleextension Note: Ensure that you've understood the how-to at Installing and maintaining contributed extensions using Git submodules before continuing.Īssume the plugin mod_mylittleextension (remember: MLE is a fake plugin) was installed in the superproject and these changes have been committed: There are some things in Git submodules, which aren't obvious and can be quite surprising. 3.5 Figure: Workflow of an update of your submodulesįirst a short explanation of events which are triggered, when a superproject is cloned.2.2 Figure: Updates without customization.2 Upgrading your submodules via the superproject.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |