Git Access on Drupal: How to Get and Use Git to Start Committing Modules and Patches
Want to contribute back to the Drupal community? Don't be afraid, Git is not as hard as you might think. There are plenty of resources available to those who search. Drupal recently switched over to Git from CVS. Much of the documentation on Drupal.org is out of date, so if you see documentation related to CVS, remember that Drupal now uses Git.
This post will serve as a way of helping you to get involved in the Drupal community and contributing modules back.
Get Git Access
First off, set up an account on drupal.org if you don't already have one. Next, you'll need to turn on git access for your account. To actually be able to use Git to release modules, there are two ways forward for you. You can:
- Request to co-maintain a module
- Submit your own module
The easiest way for a beginner is to help co-maintain a project. Start by fixing an open issue in the module's queue and submitting a patch. Then, offer to co-maintain the module. If nobody responds, start abandoned module proceedings to see if you can become that module's maintainer. If you are new to Drupal, be sure you use Drupal coding standards. See the module review process link below for more tips. The documentation for becoming a co-maintainer is a bit in flux, so here is where you apply to have the webmaster give you git access to co-maintain a module. Make sure you provide a link to the issue in the module maintainer's queue where you make the request. Any module maintainer can give you git access access to commit to a specific project by adding you as a maintainer with "access to VCS" checked. Note: You cannot create your own contrib modules without creating a sandbox project which is approved below.
It may actually be coin toss as to which is easier, to become a co-maintainer or to create your own module. In order to create your own, you'll need to create a sandbox project. Sandbox projects are sample modules that are then reviewed by the community. When its ready, submit it for review here, and, if your module passing Drupal's standards, your Pinhoccio can become a real boy. You'll also have Git access. See below for more information on working with Git to create your project. The first module I created was a duplicate, and I did not get commit access, so think carefully. Drupal module reviewers may also be picky about coding standards. Make sure you do things the "right" way.
Since Drupal is an open-source community, sometimes it takes a while to have your patch, co-maintainer request, or sandbox project reviewed. It helps to know people that you can ask to review it request, or, you can find a related module, and ask that maintainer to review your code. Developers are busy people, but open-source developers are often quite helpful, sometimes so much so that they become overloaded with work. So finding a less active member of the community and asking for help can result in a response by breaking the bystander effect.
Drupal Git Howto
Once you have created your module, you'll need to initialize the Git repository, upload code, and create a release for your sandbox project or module. The instructions for setting up a checkout for your specific project, as well as tagging and branching, is detailed on the project page of your newly-created module:
Make sure you tag your project correctly using standard Drupal module naming conventions, or your module will not appear properly. Here are some additional git resources if that is insufficient:
- Git Immersion: practice Git commands step by step. A great resource
- Tagging and branching in Drupal
- Migrating from SVN
- A good Git overview with comparisons to Subversion
- Drupal Git handbook
- CVS and Git
- Git GUIs
Create a tag, switch your local branch, and commit code. Next, go to your project page and set that committed code to be your project's active release. Give it about twenty minutes to show up. While you are waiting, upload your SSH key to your account using the "SSH" tab on your Drupal.org user page.
Tags: vcs