Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Submitting your first PR

Job
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

Job

February 13, 2020
Tweet

More Decks by Job

Other Decks in Technology

Transcript

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

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

    Clone • Branch • Commit • Pull Request • Merge Terminology
  3. master branch commit commit commit pull request merge org:WooCommerce master

    branch commit commit commit pull request merge local clone pull push
  4. 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
  5. • 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
  6. 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
  7. • Self-assign issue • Branch 
 (give relevant name, e.g.

    /fix-2 where #2 is the bug report) • Edit code • Save changes Branch and Edit
  8. • 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
  9. Compiling • Fork WooCommerce • Clone it to your local

    install • Do same for our top extensions
  10. 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