For a small number of people working on the same project, we've found Git works well with a central repository. This central repository holds the canonical version, which automatically updates the development server.
Preliminary notes
Steps One and Six of this walkthrough are aimed at setting Drupal. Everything else is more widely applicable. Most comes directly from this post - it's reproduced here primarily as a reminder checklist.
Coding standards are there to help. If one developer uses tabs while another uses spaces, it can make diffs unusable.
The following words in the instructions depend on your particular set up and preferences:
drupal-version - 6.20, 7.1, atrium, pressflow etc,
mysite - the name you choose for your site
/home/git - a directory for bare repositories on your server
/var/www - path to web server
origin, bare, dev - git remote repositories can be called what you like
master - the name of the git branch. In this setup, only the 'master' branch gets reflected on the web server.
Step One
Unpack local version.
cd /var/www/
tar -zxf ~/Desktop/drupal-version.tar.gz
mv drupal-version/ mysite/
Step Two
Set up local git repository.
cd mysite
git init
git add .
git commit -m 'Initial commit'
Step Three
SSH to the server, create the central and working repositories there.
// Make a bare repository in the 'git' home directory.
cd /home/git
mkdir mysite.git && cd mysite.git
git --bare init
// Make a working copy in the web server directory, adding the 'bare' repo as a remote.
cd /var/www/
mkdir mysite && cd mysite
git init
git remote add bare /home/git/mysite.git
// Return to the bare repo and add a post-update hook.
cd /home/git/mysite.git/hooks
vim post-update
// Write this to the post-update file
cd /var/www/html/mysite
unset GIT_DIR
git pull bare master
exec git-update-server-info
// Enable the hook.
chmod +x post-update
Step Four
Return to your local machine and add the remote repository.
git remote add origin git@xxx.xxx.xxx.xxx:intranet.git
git remote add dev ssh://root@xxx.xxx.xxx.xxx/home/git/intranet.git
git remote -v
(The root remote - 'dev' - is necessary for pushes. The 'origin' remote is usable for pulls. Setting this up once here means I can do my pulls without being prompted for the root password. If you're sometimes in the same network as the central server and sometimes out of the office, you can add further remotes for this.)
Step Five
Ignore some files.
The update-index --assume-unchanged is especially good for 'settings.php', and is why we haven't set up the database yet.
http://zendoodles.wordpress.com/2010/11/24/ignore-files-in-git/
Don't forget the .gitignore file too, which is copied around with the git repo. For project-wide exclusions, add the filename or pattern to .gitignore and that will passed to anyone who clones the project.
Step Six
Install local site.
cd /var/www/mysite
cp sites/default/default.settings.php sites/default/settings.php
chmod a+w sites/default/settings.php
chmod a+w sites/default
http://localhost/mysite/install.php
Step Seven
First push.
git push dev master
This should set up the git repository, from which any of your colleagues can push and pull, and at the same time update the central development server, which will always reflect the latest changes.
Combine this with Features, Strongarm, and keep all Views and Panels in code, and you should never have to touch the development server.
Comments
锘縲ww.monclersdunjakke.com
Michael Kors Carteira
polo shirt bedrukken
monster beats test
billige polo shirts
锘縲ww.franceralphlauren.net