11

Back when drupal was in CVS I had my sites in a git repository and then pulled in core and contrib via CVS. The two systems happily co-existed and I could track changes to everything and make patches to contrib modules. Now with git I am unsure whether to just download contrib and core and check it into my site's git repository, or maybe use submodules?

I am wondering if there are any best practices on this yet? I am particularly puzzled about how to have core as a submodule if my repo uses drupals root directory as its own root?

2 Answers 2

6

Not exactly the same question as https://drupal.stackexchange.com/questions/260/deploying-drupal-with-git but I have the same answer for you.

http://freso.dk/en/2011/02/26/managing_fresodk_from_cvs_in_svn_to_git

I think it can be useful to have Drupal Core as a real check out, makes it for example easier to track hacks. Because sometimes, there simply is no other way, be it changes to .htaccess or maybe you applied some patches for bugs which affect you directly.

4
  • I like that approach. The only thing I am still unsure of is how to push the repo to remote? I mean if the base checkout is from drupal.org?
    – naxoc
    Commented Mar 4, 2011 at 18:55
  • You can have as many remotes as you want. To make it easier, you could rename the drupal remote to drupal (git branch rename origin drupal), then add your own as the origin (git remote add origin [email protected]:repo.git). You can then still configure the core branch (7.x) to pull from drupal by default (git branch --set-upstream drupal/7.x 7.x)
    – Berdir
    Commented Mar 4, 2011 at 19:03
  • Perfect. That is just what I was looking for!
    – naxoc
    Commented Mar 4, 2011 at 19:24
  • Just a small correction to git branch rename origin drupal - it should be git remote rename origin drupal.
    – naxoc
    Commented Mar 4, 2011 at 20:01
3

As you shouldn't be hacking core, reverse your thinking: instead of making core a submodule of your site, make your custom code a submodule of core. Once you clone the core repository, you can do whatever you want to it, including adding your own submodules to it.

Alternatively, consider not using the core git repository for your site and update to the latest release using other functions, like drush. This way, you'd only have to submodule contrib modules. Unless you're contributing to core or doing bleeding edge things that depend on bug fixes that haven't made it into a release yet, the utility of getting all commits via VCS is minimal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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