Surviving Git Submodules

I’m a fan of submodules in git, but sometimes it seems like I’m the only one! After having worked with this approach on a few projects, I’m coming to the conclusion that, like so many other things, it’s easy when you know how! So, I tried to take my handwavy explanation of how to work with submodules, and turn it into a handy diagram for you …

Surviving Submodules

The basic premise is this: remember that you need to commit to both the parent project and the submodule – do the submodule first. You need to update the submodule when you update your main project. Stay away from git add . because it’s alarmingly easy to revert submodule changes … so simple really :)

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)