getting involved w/ drupal - patches

Post on 09-Feb-2017

114 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Getting involved w/ Drupal - Patches

ciandt.com

cgasparoto@ciandt.com

ciandt.com

What is a patch?

“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

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

ciandt.com

ciandt.com

Creating a patch

Easy way: git diff

ciandt.com

git diff > patch-name.patch

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

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

ciandt.com

Applying a patch

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

Pro way: git am

ciandt.com

git am patch-name.patch

ciandt.com

Submitting a patch

Submitting a patch

ciandt.com

Submitting a patch

ciandt.com

Submitting a patch

ciandt.com

Submitting a patch

ciandt.com

Submitting a patch

ciandt.com

Dreditor - Chrome Extension

ciandt.com

Questions?

ciandt.com

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

Thank you!

ciandt.com

top related