Changes between Version 6 and Version 7 of faq/gitification


Ignore:
Timestamp:
May 25, 2012, 8:55:10 PM (8 years ago)
Author:
Bart
Comment:

Update module using git-subtree and git-rebase

Legend:

Unmodified
Added
Removed
Modified
  • faq/gitification

    v6 v7  
    2525We don't want the settings.php file in our repository as it contains database login credentials so we tell git to exclude it:
    2626{{{
    27 echo /settings.php >> .git/info/exclude
     27echo settings.php >> .git/info/exclude
    2828}}}
    2929
     
    4545}}}
    4646
    47 We copy our settings.php to our repository directory, create a symbolic link from inside the core and delete the default.settings.php:
     47We copy our settings.php to core/sites/default and delete the default.settings.php:
    4848{{{
    49 cp ~/settings.php .
    50 cd core/sites/default
    51 ln -s ../../../settings.php
    52 git rm default.settings.php
    53 cd ../../../
    54 git add core/sites/default/settings.php
    55 git commit "Add symbolic link to settings.php."
     49cp ~/settings.php core/sites/default
     50git rm core/sites/default/default.settings.php
     51git commit "Deleted default.settings.php."
    5652}}}
    5753
     
    6056== Drupal modules ==
    6157
    62 Normally, Drupal modules are installed under sites/default/modules. This would be fine with our approach but it would create unnecessary huge merges when updating the core and it keeping all parts separately accessible from the root directory of our installation is much clearer arranged. So we create a modules (and perhaps also a files, libraries and themes) directory and a symbolic link to it:
     58Normally, Drupal modules are installed under sites/default/modules. This would be fine with our approach but it would create unnecessary huge merges when updating the core and it keeping all parts separately accessible from the root directory of our installation is much clearer arranged. So we create a modules (and perhaps also a files, libraries and themes) directory, a symbolic link to it and add commit the link:
    6359{{{
    6460mkdir modules
     
    6662ln -s ../../../modules
    6763cd ../../../
     64git add core/sites/default/modules
     65git commit -m "Add symbolic link to modules directory."
    6866}}}
    6967
     
    8987}}}
    9088
    91 As our core directory is not empty, we can add the symbolic link to our modules directory:
     89== Update a patched module ==
     90
     91First, we create a new [http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging branch] containing the version of our module we want to update to. As we have already added i18n as a remote we can checkout the desired version in a separate branch using the corresponding [http://git-scm.com/book/en/Git-Basics-Tagging tag]. As long as there are no [http://git.661346.n2.nabble.com/1-8-0-Remote-tag-namespace-td5980437.html separate namespaces for remote tags] in git we definitely want to start with a git fetch to be sure to refer to tag of the right module:
    9292{{{
    93 git add core/sites/default/modules
    94 git commit -m "Add symbolic link to modules directory."
     93git fetch i18n-6.x-1.x
     94git branch i18n-6.x-1.10 6.x-1.10
    9595}}}
    9696
    97 == Update a patched module ==
     97Then we extract the patched version of our module into a branch along with it's history:
     98{{{
     99git subtree split --rejoin --prefix=modules/i18n --branch=i18n-linksunten
     100}}}
    98101
     102Now we can rebase our branch on top of the new version of the module:
     103{{{
     104git rebase i18n-6.x-1.10 i18n-linksunten
     105}}}
     106
     107Finally, we have to merge the patched new version into our master branch:
     108{{{
     109git subtree merge --squash --prefix=modules/i18n i18n-linksunten
     110}}}
     111
     112After that, you can delete the two branches:
     113{{{
     114git branch -D i18n-6.x-1.10 i18n-linksunten
     115}}