Presentation on managing Drupal projects with Git and GitHub

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
awebb's picture

I just thought I post a little information about a presentation I am going to be giving at the October meetup. At the last meetup, I was asked if I would mind giving a presentation on the use of GitHub in managing Drupal projects. We have pretty much switched all of our development versioning to Git at CollectiveColors.com, because it has shown to have significant benefits in our own development processes.

Git makes it easier for us because:

  1. It allows us to better collaboratively develop our software while minimizing the impact of code conflicts.
  2. Allows us to easily track what we have developed.
  3. Branching and merging of repositories is a breeze.
  4. It is very easy to turn any directory tree into a Git repository.
  5. Git submodules are perfect for Drupal development.

We have learned a lot of really cool methods for managing software projects using Git and GitHub, so we figured that we would share some of what we have learned in our journey so far. Although, I have a rough outline of what I want to talk about during this presentation, I am open to hearing your suggestions, after all I'm not presenting to myself.

So what I am thinking so far? ...


Managing Drupal projects with Git and GitHub


1. What are Git and GitHub?

Seeing that there will probably be people at the meetup that do not use versioning for their development, or have not heard of Git, I will be covering, briefly, what Git is and why it is important to developers. Why use Git over CVS ( used by Drupal ) or SVN ( a much better CVS )? What are some of the features that make Git so useful? I will also be introducing GitHub, a truly ( logical ) awesome service for Git enthusiasts. GitHub basically makes it very easy to track development and collaboratively develop software projects. Think of it as social networking meets software development. And Gists are really cool too! You will learn why these tools are invaluable assets in your own software development efforts.

2. Why are Drupal and Git a good fit?

Drupal and the Linux kernel have a lot in common. They are both really popular open source projects. They both have more modular architectures which lend themselves well to the distributed source control methods employed by Git. In fact Git was created by Linus Torvalds for use on the Linux kernel so that the larger code base could be more easily managed by a group of dedicated developers. The module system of Drupal also lends itself quite well to a submodule approach to site building. I will be introducing you to this approach. Also you will hear about some resources that could make your Drupal development even easier with Git.

3. How do you set up a Drupal project?

I will be taking you through the process of creating a Drupal project using Git. Should you host your project on your own server ( via SSH ) or should you use GitHub? Each has it's own strengths and weaknesses. Since distributed project development requires networked repositories, I will be briefly covering the available options to you in starting a project that can be externally accessed and developed.

4. Toto, we're not dealing with drupal packages anymore.

When you work with Git repositories of modules that you use everyday, you will notice that it is a shift from the way you used to do it. No longer do you go to drupal.org and download packages. In fact, you don't even use drush, but it is just as easy. So what do you do when modules or core are updated? How can you use the Git approach to manage your client codebase? This is where submodules come in handy. The traditional Drupal motto has been don't hack core. What if you could, safely? Using the awesomness of Git merging and distributed source control, centrally managed software development may not be necessary. We will discuss the pros and cons of such an approach. I would really like to git your feedback. Ha ha.

5. Come together. ( The case for collaborative development with GitHub )

GitHub is really freakin awesome ( did I mention that already? ). It makes it easy for non technical people to understand what is happening with the projects that they are interested in. This can really help you reach people that could benefit from your code. I will discuss some of the benefits to working on projects together and how it can help us share what we develop easily with one another. The decentralized Git approach gives us an easy way to fork projects. We can then merge features from other developers or from our own forks. This gives us a lot of power to radically and safely evolve our code, and that is what gives us our advantage.

6. Managing data with Git.

Have you ever thought about versioning your database? Versioning your database can be a great way to backup and recover your precious data. What would we be without our 1's and 0's? Well, I decided to try versioning Drupal databases with Git and Drush around the end of August. I thought I would try an experiment. On one hand I would have a regular backup process dump and zip database snapshots, and on the other a git repository with a single uncompressed database dump that was commited at an interval. The results over the month have been quite impressive. I will go over the results and why I think that versioning your database is the absolute best way to manage your data. It works for all kinds of databases, even flat files. I will also be releasing the shell script that I wrote to perform the git backups for me.

So now you have an idea of what I think I should be talking about. What do you think?

Oh, one more thing. Don't hesitate to read up on Git or GitHub before the meetup. Trust me, it will be worth your time. Git and GitHub really can change the way you develop.


Some resources

http://git-scm.org

This is the official Git site. It has a lot of good documentation.

http://github.com

Take a look around GitHub. Try registering for a free account to get a feel for the interface.

The book [ Pro Git by Scott Chacon ] has proven to be most useful in my quest for information. It also goes over the internals which is really cool.

And of course, you always have the Git man pages.

Thanks,
Adrian

Comments

Fantastic

cjdavis's picture

Adrian this is great. I am really, really interested in your scripts to do db versioning.

How difficult do you think it would be to create an extension / hook / module for drush to do the commit to git from the command line? How about from the backup and migrate module?

Looking forward to this.

That's a really good idea.

awebb's picture

It should be really easy. Drush is really pluggable and we are basically mixing shell operations, which php can do pretty well.

This presentation has been moved back to the next meetup

awebb's picture

Seeing as how there will not be a projector handy, it does not make sense to give it. This will be a longer presentation, where I will be walking you through some slides and features of GitHub.

Thanks,
Adrian

Slides/Notes/recording

alanburke's picture

Hi Adrian,
Do you have any slides/notes/recording of this presentation?
In particular, I'd like to see how submodues would work in a Drupal setup.
Regards
Alan

publish?

topdillon's picture

I am in dire need of precisely this--and I know it. For me and others like me, and also for those who are unaware of their similar need, would you ever publish this? Any medium would do, print, video, plasticine...

+1 for this. are any

okmi's picture

+1 for this. are any presentation materials online?