For my project, I have a custom module, a features module and a custom theme. I want to keep all in a single Git-Repository.

The problem is: modules need to be in sites/all/modules, themes in sites/all/themes.

I know, I could bundle both in a profile. But I am already using a special profile. And as far as I know, there is no way to inherit a profile.

And yes, I know I could use symlinks. But they tend to create issues with path structures.

So is there another, maybe a "Drupal" way to bundle modules and themes in one directory?

  • symlinks should not create issues with path structures
    – arpitr
    Commented Jan 29, 2015 at 20:35
  • How about using Drush Make? drupal.stackexchange.com/questions/18664/…
    – calebtr
    Commented Jan 29, 2015 at 23:40
  • Why you don't store whole sites in your repository?
    – kenorb
    Commented Jan 30, 2015 at 18:09
  • @kenorb: Well, it's a bit dirty, since you end up having foreign code (incl. changes) in your own repo. But yeah, deployment is easier that way. Commented Feb 5, 2015 at 14:12
  • 1
    I think you should keep custom module, feature module and custom theme in separate repositories and then use git submodules to place them together in a single git repository, but I'm not sure if that's what you're looking for.
    – kenorb
    Commented Feb 5, 2015 at 14:22

1 Answer 1


Thanks to the suggestion of @kenorb, I have found a good way to solve this:

I init the git repository in drupal/, and I put only the following line into .gitignore:


Then, I add (by force) my custom module and theme folders:

$ git add -f sites/all/modules/custom
$ git add -f sites/all/themes/custom

With this, my repo still contains only my code and no Drupal modules. And this allows me even to track also my .htaccess, with:

$ git add -f .htaccess

Not the answer you're looking for? Browse other questions tagged or ask your own question.