I recently fixed address field plugin module, so I wanted to document my process, so I can always refer to it, instead of wasting time surfing the internet. This guide will help you to better understand how to contribute to the community.
2. Best practices in creating issues
2. Understand the basic commands of git(push,pull,fetch,clone)
3. You must have a drupal.org account
Before I continue with this post, some may think why should I care about a simple typo in drupal module…
Pssst, by correcting small typo, you are doing a lot to the community and this is a form of value you are providing and a sign of appreciation, aside that, you are gradually putting your name out there on the platform, making you available and giving you presence online as a drupal contributor so companies can hire you. You convinced enough right?
Whenever you detect a blog or typo in any drupal code-base, you can help the community by reporting the issue.
I’m just going to use my new module I just fixed as a typical example
a) Go the module page on drupal.org, in my case its https://www.drupal.org/sandbox/togbonna/2060269
b) Click on open issue and create issue
c) Specify what you doing, in my case I’m fixing all states in my country, it’s a feature request, I wanted to complete the whole state.
Note: if you are reporting and want to work on it, you can assign issue to yourself, this will notify other developers that you are working on it.
The following process is on your local machine, make sure you have git installed
a) Go back to the module page and click on version control tab
b) Copy the the unique URL to clone the project to your local machine
git clone --branch 7.x-1.x https://git.drupal.org/sandbox/togbonna/2060269.git address_field_nigeria
Creating a branch will help you have your own clean slate to work with.
Git checkout –b fix-36-states
Then you can start working on the issue, after you are done
# Commit changed files to your topic branchgit commit -a -m "Issue #123456 by username: fixed all 36 states"
Git rebase simply means, you connect back to the main tree. This help you pull any recent changes from the source file
git fetch origin
Join back to the main tree
# Commit changed files to your topic branchgit rebase origin/[branchname] #e.g. my branch name is 7.x-1.x
git diff > [description]-[issue-number]-[comment-number].patch
The git command will create .patch file on your local machine.
Before submitting your patch, make sure you test the code and verify it works, after verifying, you can submit your patch and wait patiently for the maintainer/author to review it.