Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Submitting your first PR

February 13, 2020

Submitting your first PR

I gave a workshop for the WooCommerce Happiness Engineers on submitting pull requests to GitHub.

* We discussed rerminology: Fork, Clone, Branch, Commit, Pull Request, and Merge
* We went on a bug hunt in a WordPress plugin I had messed up (deliberately)
* We submitted some pull requests together


February 13, 2020

More Decks by Job

Other Decks in Technology


  1. Submitting your first PR Job Thomas @jobtex

  2. • Most recent (dev) version • Fast updates / syncing

    • Testing • Contributing GitHub = ?
  3. How would you explain the following terms? • Fork •

    Clone • Branch • Commit • Pull Request • Merge Terminology
  4. master branch commit commit commit pull request merge

  5. master branch commit commit commit pull request merge master org:WooCommerce

    org:jobthomas fork
  6. master branch commit commit commit pull request merge org:WooCommerce master

    branch commit commit commit pull request merge local clone pull push
  7. Terminology Clone copy GitHub repo to local install Fork copy

    GitHub repo to personal account Branch split off to test new code without touching main Sync sync online and local Commit save code changes to branch Pull request submit code changes to plugin master Merge accept code changes and combine branches
  8. • Go to this repo: github.com/jobthomas/your-first-pr - Fork it -

    Clone it (to local wp-content/plugins) • Use GitHub desktop app or Terminal • Activate on local install Branch and Clone
  9. To fork or the branch?

  10. Find and Submit Issues There are 6 bugs in the

    code. Find them!
  11. File: wc-minimum-order-amount.php 1. Line 37: <script>alert("SHOW ME THE MONEY!”);</script> could

    be malicious code 2. Line 42: color: white; makes amount you add in settings not readable 3. Line 61: your order must be at least % is missing an “s” after the percentage sign 4. Line 73: h_wc_minimum_order_amount function is missing an “s” (should be hs_) 5. Line 83: total > $minimum will only show if the order is higher than the minimum, it should be “<” instead File: readm.txt 6. File name should be readme.txt Extra points 7. You’re likely testing this with a more recent version of WooCommerce and WordPress than is declared in the readme file. You can update that. 8. Update the version number of the plugin and the changelog Find and Submit Issues
  12. • Self-assign issue • Branch 
 (give relevant name, e.g.

    /fix-2 where #2 is the bug report) • Edit code • Save changes Branch and Edit
  13. • Commit changes - Commit regularly - For small edits

    • Pull request - Into jobthomas/your-first-pr/tree/master - Extra points: add a gif in the PR description Commit and Pull
  14. Compiling • Fork WooCommerce • Clone it to your local

    install • Do same for our top extensions
  15. And now for real

  16. And now for real • Find open issue on WooCommerce

    - Easy to fix - Within your skills set - Tip: go to: https://github.com/issues - Delete author:your-username - Look for: label:"[Type] Good First Change" • Fork and clone (or if other plugin: clone and branch) • Branch and edit • Commit and submit PR
  17. Thanks! Job Thomas @jobtex