getting involved w/ drupal - patches

20
Getting involved w/ Drupal - Patches ciandt.com [email protected]

Upload: cleber-gasparoto

Post on 09-Feb-2017

114 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Getting Involved w/ Drupal - Patches

Getting involved w/ Drupal - Patches

ciandt.com

[email protected]

Page 2: Getting Involved w/ Drupal - Patches

ciandt.com

What is a patch?

Page 3: Getting Involved w/ Drupal - Patches

“Patches are pieces of code that solve an existing issue. In fact, patches describe the changes between a before and after state.”

drupal.org/patch

ciandt.com

Page 4: Getting Involved w/ Drupal - Patches

Patch example - https://www.drupal.org/files/issues/2809583-bootstrap-phpcs-fix-4.patch

ciandt.com

Page 5: Getting Involved w/ Drupal - Patches

ciandt.com

Creating a patch

Page 6: Getting Involved w/ Drupal - Patches

Easy way: git diff

ciandt.com

git diff > patch-name.patch

Drupal standard: git diff > example-[short-description]-[issue-number]-[comment-number].patch

Page 7: Getting Involved w/ Drupal - Patches

Pro way: git format-patch

ciandt.com

git format-patch <source-branch> > patch-name.patch

Example: git format-patch -10 HEAD --stdout > 0001-last-10-commits.patch

$ git checkout dev$ git format-patch master --stdout > diff-dev-master.patch

Page 8: Getting Involved w/ Drupal - Patches

ciandt.com

Applying a patch

Page 9: Getting Involved w/ Drupal - Patches

Easy way: git apply

ciandt.com

git apply /path/to/my/patch/patch-name.patch

Example: git apply --stat fix-phpcs.patchgit apply --check fix-phpcs.patch

Page 10: Getting Involved w/ Drupal - Patches

Pro way: git am

ciandt.com

git am patch-name.patch

Page 11: Getting Involved w/ Drupal - Patches

ciandt.com

Submitting a patch

Page 12: Getting Involved w/ Drupal - Patches

Submitting a patch

ciandt.com

Page 13: Getting Involved w/ Drupal - Patches

Submitting a patch

ciandt.com

Page 14: Getting Involved w/ Drupal - Patches

Submitting a patch

ciandt.com

Page 15: Getting Involved w/ Drupal - Patches

Submitting a patch

ciandt.com

Page 16: Getting Involved w/ Drupal - Patches

Submitting a patch

ciandt.com

Page 17: Getting Involved w/ Drupal - Patches

Dreditor - Chrome Extension

ciandt.com

Page 18: Getting Involved w/ Drupal - Patches

Questions?

ciandt.com

Page 19: Getting Involved w/ Drupal - Patches

References & Links

ciandt.com

● Git Best Practices: Upgrading the Patch Process● Drupal Patch Page● Drupal Contributor Tasks● More about patches● Drupalize.me - Patch Tutorial● Git - git format-patch documentation● Git - git-am Documentation● Nice article about git patch● Dreditor

Page 20: Getting Involved w/ Drupal - Patches

Thank you!

ciandt.com