Developing your codebase

Managing your PaaS subscription

After you prepare your Acquia Cloud Site Factory development environment, use the information on this page to help you develop your website's features.

Based on the branch-per-feature model, you should create branches for each of the features that you want to develop, based on the master branch from your code repository. Be sure to upload your custom distribution's files before you begin to develop your website.

Creating a feature branch

To set up a feature branch:

  1. Open a command prompt window, and then change the directory to the location that contains the clone of your code repository.
  2. Switch to the master branch.

    git checkout master
    git pull origin master
  3. Create the feature branch with a descriptive name that relates to the code that it contains, and then switch to the new branch using the following commands, replacing [feature_id] with the name of your feature branch:

    git checkout -b [feature_id]
    git push origin [feature_id]

Create and use as many feature branches as needed to keep your development efforts separate from one another.

Where do I put my code?

As you develop each code branch, place code changes and additions in the folders appropriate for your version of Drupal. Placing your changes in other folders can cause serious problems for your repository, including merge conflicts that Acquia will not be able to help you resolve.

Drupal 8

Drupal 8 expects code changes in the following directories:

Directory Suggested contents
docroot/libraries Third-party libraries, such as WYSIWYG editors
docroot/modules/custom Custom modules
docroot/modules/contrib Modules from Drupal.org
docroot/profile Custom profiles
docroot/themes  

Drupal 7

Drupal 7 expects code changes in the following directories:

Directory Suggested contents
docroot/sites/all/modules  
docroot/sites/all/modules/custom Custom modules
docroot/sites/all/modules/contrib Modules from Drupal.org
docroot/sites/all/libraries Third-party libraries, such as WYSIWYG editors
docroot/sites/all/themes  
docroot/profiles Custom profiles

Committing branch changes

Whenever you want to commit your changes back to the code repository for the branch that you're working on, run the following command to commit the change locally:

git commit -a -m "Comment"

After you commit the change, send the change to the code repository (where [feature_id] is the name of your feature branch):

git pull origin [feature_id]
git push origin [feature_id]

Additional information

As you are working with your code, if you need to run a Drush command that only affects one of your websites, be sure to use the --uri=site.host.com parameter, where site.host.com is your website's complete site and domain name.

Next step

Whenever you have finished developing feature branches for your websites and you want to ensure that they work correctly, you can integrate and test your feature branches on copies of your websites hosted on your development or staging environments.

Contact supportStill need assistance? Contact Acquia Support