Editing a git submodule

You don’t need a seperate clone. The sub-module folder is a world of its own. Just edit, commit, branch, and push to your heart’s delight.

Git is great that way. 🙂

BTW, the parent repository will even detect when changes happen inside the sub-module folder and offer you to commit the current state of the sub-module as the new official reference point for clones of the parent repo.

Important note:

Make sure you do git checkout master (or some other branch) inside the sub-module folder before your start hacking.

Then also make sure when you commit the updated state of the sub-module, that you either push those commits to a public repo, or at least that you don’t rebase or otherwise change the history inside the sub-module afterwards – as that would corrupt the parent’s reference to the sub-module’s history.

Tread with care. (Hat tip to @pjmorse for the reminder.)

Bottomline:

Yes. Developing within a submodule folder is possible and often convenient but not without its risks. Choose your development model wisely

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)