Re-roll Twig patches

Final / Up to date -- AWAITING PEER REVIEW
Learn to update or "re-roll" patches to apply to a newer version of Drupal

In this lesson you will learn to Re-Roll a patch so that the patch will apply cleanly to Drupal 8 - in it's present state.

  1. Make sure you're running the latest version of Drupal 8
    cd path/to/drupal
    cd checkout 8.x
    git pull origin 8.x
  2. Create your own local working branch:
    git checkout -b example-twig-issue
  3. Go to the Drupal core issue queue and search for issues that are tagged with both Twig and Needs Re-Roll (or use the link at right)
  4. Choose an issue. Download and try to apply the patch attached.
    • If it applies cleanly, add a comment to the issue stating that "the patch applied cleanly" and remove the tag Needs Re-roll. Then go back to step 3.
    • If Git reports errors when trying to apply the patch, the patch needs to be re-rolled.
  5. Work through files with conflicts one-by-one.
    • Open each file with conflicts, manually resolve the conflicts. (see this lesson for more on resolving conflicts
    • Stage your edits to be committed like this:
      git add path/to/fixed/file
  6. When all the files with conflicts have been fixed, save your work:
    git commit -m 'Resolving conflicts between 8.x and example.patch'
  7. Now create a new patch:
    git diff origin/8.x > my-new.patch
  8. Test your patch on branch 8.x to make sure it works
    git checkout 8.x
    git apply path/to/my-new.patch
  9. Then reset to clean up branch 8.x
    git reset --hard
  10. Now upload your patch to the selected issue on, remove the tag for Needs Re-roll, and change the status to Needs Review

Lesson tags: