How to contribute a patch to Drupal
Login to Drupal.org, login to Drupal GIT
Go to the project page, such as https://www.drupal.org/project/webform_validation
Go to version control, select branch, click SHOW button to get the right command
In a temp directory, copy-paste the command, for example
git clone --branch '2.0.x' https://git.drupalcode.org/project/webform_validation.git
then go into that directory
cd webform_validation
if you didn't choose the right branch, you can show all available branches and choose one with checkout, this will automatically update all files
git branch -a
git checkout [branchname]
then create a new "branch" with the command
git checkout -b [issue-number]-[short-description]
for example
git checkout -b 3236539-indentical-values-validation
then make changes
see if your changes are correctly recognized with the command
git diff origin/[branch_name]
for example
git diff origin/2.0.x
then make the patch file with the command
git diff origin/[branch_name] > [patch_name]
patch_name is [project_name]-[short_description]-[issue_number]-[comment_number].patch
example command:
git diff origin/2.0.x > webform_validation-fixes_identical_values_validation_error-3236539-4.patch
upload the patch to the issue and activate automatic testing
when testing is a success, update the issue with a message highlighting the new patch and change the issue status to "needs review"
=> patches are mainly useful for using them on your own system. Drupal has a newish preferred way of making code changes: GIT merge requests.
read my notes on making merge requests here:
https://drupaldope.com/drupal-9/dream-youre-dev-part-2-contribute-code-drupal
- Log in to post comments
Comments