Your SlideShare is downloading. ×
Building a Drupal site with Git
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Building a Drupal site with Git

2,254
views

Published on


0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,254
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
40
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Building a Drupal site with GitDiagrams and NotesJan 2013Provided by dumbassPlease note this is currently a documentation for discussion- it hasnot been reviewed yet. Please leave any useful commentsThis document should be used in conjunction with the excellenttutorial on Drupal.org
  • 2. Creating the Central Repository $ ssh username@mysite.com Server $ cd ~ with user public_html $ git init --bare fooproject.gitfooproject fooproject.git* * This directory is not the working tree, where you edit and commit code. Rather, it is simply the central location for the git objects and history.
  • 3. Locally Cloning Drupal TIP Before you issue these commands Ensure you are in the correct directory where you want to install your local Drupal installation by navigating to the correct directory by using the usual git://drupalcode.org/project/drupal.git $ cd path/to/my/directory $ git clone git://drupalcode.org/project/drupal.git Local fooproject $ cd fooprojectmachine $ git checkout 7.0 local_development_environment This command clones a copy of the fooproject latest Drupal code into a local folder named fooproject
  • 4. How your setup should look public_htmlServer fooproject.git* Localmachine local_development_environment fooproject
  • 5. Updating Remotes Rename the original origin remote (the drupal.org Drupal project repository) to ‘drupal’ Local machine $ git remote rename origin drupal $ git remote add origin path/to/your/central/git/repo (example: ssh://fooproject@fooproject.com/home/fooproject/fooproject.git)TIPTo end your current remote session andstart working locally useCTRL+D
  • 6. Creating a Working Branch $ git branch fooproject $ git checkout fooproject Localmachine local_development_environment fooproject (fooproject) You now have a git branch called fooproject. You can use this fooproject branch as a working branch to add contributed and custom modules and themes to your site. Consider it the equivalent of the default Git ‘master’ branch for your project.
  • 7. Complete local installation of Drupal Localmachine At this point, you should complete the Drupal installation process to get a working local installation.
  • 8. Pushing Code to the Central Repository and Completing Initial Deployment Local local_development_environmentmachine fooproject (fooproject) $ git push origin fooproject public_html Server fooproject.git (fooproject)
  • 9. Pushing Code to the Central Repository and Completing Initial Deployment $ git clone --branch fooproject ssh://fooproject@fooproject.com/home/users/foo project/fooproject.git fooproject_dev public_htmlServer fooproject.git (fooproject) fooproject_dev This fooproject_dev version could exist on another server. But is a sub – directory in this example. Once you have completed your initial pull you will see the Drupal file structure on the server
  • 10. Complete dev installation of DrupalServer Now, you have a fooproject_dev directory that you can use as the root of a new virtual host. You can proceed through the normal Drupal installation process using this development copy of your site and a separate database for it. Repeat this process for the Staging and Production environments - we’ll assume that they live on the same server in directories fooproject_stg and fooproject_prod.
  • 11. Pushing Code to the Central Repository and Completing Initial Deployment public_html Server fooproject.git (fooproject) fooproject_dev fooproject_stg fooproject_prod
  • 12. Staging and Production - Tag Based Deployment Localmachine $ git tag prod_20110419 ## Creating a tag from the current commit. You can specify a commit here if you wish. $ git push origin prod_20110419 Server $ git pull $ git checkout prod_20110419