Git Submodules

Git Submodules: Adding, Using, Removing, Updating

I took on a simple wordpress website. Well yes the site is very simple, almost no custom development but, it is wordpress and I am trying to do things with best practices. So it hasn’t been easy.

  1. Getting a virtual environment working has been a headache.

I settled on Scotchbox because it had a lot of tools but didn’t require to many strange dependencies like ruby plugins when my site is only php behind nginx or apache.

  1. I wanted to have a git repo for the environment to do code on multiple computers or to be able to hand off the project to someone else if I ever needed too.

  2. I wanted to have a git repo for the theme to be able to have releases and features.

This is the most difficult part.

Create the theme as its own git repository.
It can be a single file to start, this only to get the module setup going.

Create the top level of your project (ie the contents of a wordpress install). Use the GIST to ignore basically everything but the vagrant file, your gitmodule file and the path to the theme you are developing.


.gitignore (see gist file below)


Follow these direction using the path to your theme in the themes folder.

Once that is setup, you will be able to commit any vagrant file changes to your wordpress-site-vagrant repo and any changes to your theme can be committed to your website-theme-01 repo.

Now developing themes is a harmony and is easy to replicate across projects and is easy to share a project to multiple developers.

Leave a Reply

Your email address will not be published. Required fields are marked *