Share
Embed
Develop Very Mild Super Powers with Git
WordCamp Chicago 2014 presentation introducing Git and the mild superpowers it endows.
Brent Shepherd
June 14, 2014
Transcript
92 slides
-
Who is using version control? Who is using git? Slides:
http://goo.gl/fxDP0W -
! working tree ! not wow so bisect merge conflict
! DETACHED HEAD ! much commands merge-octopus ! confuse -
terminal vs. gui Marvel Character Trademarks & Copyright © 1941-2014
Marvel Characters, Inc. ALL RIGHTS RESERVED. Source: http://marvel.wikia.com/File:Kavita_Rao_(Earth-616)_reveals_the_Hope_Serum_(The_Cure).jpg -
$cd /plugins/my-plugin/ $git init Initialized empty Git repository in /
plugins/my-plugin -
W orking T ree ! /my-theme/ index.php style.css git repository
! /my-theme/ index.php style.css $ git commit -a -
W orking T ree ! /my-theme/ index.php style.css repository !
/my-theme/ index.php style.css index ! /my-theme/ index.php style.css multidimensional -
W orking T ree ! /my-theme/ index.php style.css repository !
/my-theme/ index.php style.css index ! /my-theme/ index.php style.css multidimensional Staging Area -
W orking T ree ! /my-theme/ index.php style.css repository !
/my-theme/ index.php style.css index ! /my-theme/ index.php style.css -
W orking T ree ! /my-theme/ index.php style.css repository !
/my-theme/ index.php style.css index ! /my-theme/ index.php style.css $ git commit $ git add -
W orking T ree ! /my-theme/ index.php style.css repository !
/my-theme/ index.php style.css index ! /my-theme/ index.php style.css $ git commit $ git add -
W orking T ree ! /my-theme/ index.php style.css repository !
/my-theme/ index.php style.css index ! /my-theme/ index.php style.css $ git commit $ git add $ git reset $ git checkout -
multimultidimensional Local Repository ! /my-theme/ index.php style.css Remote repository(s) !
/my-theme/ index.php style.css -
Local Repository ! /my-theme/ index.php style.css Remote repository(s) ! /my-theme/
index.php style.css e.g. on GitHub multimultidimensional -
Local ! /my-theme/ index.php style.css Remote ! /my-theme/ index.php style.css
$ git push origin master -
Local ! /my-theme/ index.php style.css Remote ! /my-theme/ index.php style.css
$ git push origin master -
Local ! /my-theme/ index.php style.css Remote ! /my-theme/ index.php style.css
$ git push origin master $ git pull origin master -
$git status On branch master ! Changes not staged for
commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) ! modified: changelog.txt modified: classes/class-wc-subscriptions-cart.php modified: languages/woocommerce-subscriptions.pot modified: woocommerce-subscriptions.php ! no changes added to commit (use "git add" and/or "git commit - a") -
$git add -p changelog.txt diff --git a/changelog.txt b/changelog.txt index 274d1ae..5624ae9
100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,6 @@ *** WooCommerce Subscriptions Changelog *** -2014.06.nn - version 1.5.4 +2014.06.12 - version 1.5.4 + * New: 'processed_subscription_renewal_payment' hook + * Tweak: allow admin to limit subscription by status * Tweak: improve shipping price displayed in the order totals table after checkout and via the My Account page when the order includes recurring shipping Stage this hunk [y,n,q,a,d,/,e,?]? -
Stage this hunk [y,n,q,a,d,/,e,?]? ? y - stage this hunk
n - do not stage this hunk q - quit; do not stage this hunk or any of the remaining ones a - stage this hunk and all later hunks in the file d - do not stage this hunk or any of the later hunks in the file g - select a hunk to go to / - search for a hunk matching the given regex j - leave this hunk undecided, see next undecided hunk J - leave this hunk undecided, see next hunk k - leave this hunk undecided, see previous undecided hunk K - leave this hunk undecided, see previous hunk s - split the current hunk into smaller hunks e - manually edit the current hunk ? - print help @@ -1,6 +1,6 @@ *** WooCommerce Subscriptions Changelog *** Atomic Commits FTW -
Eidetic Memory Character Trademarks & Copyright © 1941-2014 Marvel Characters,
Inc. ALL RIGHTS RESERVED. Source: http://x-men.wikia.com/wiki/Sage -
$git log commit 45e9b78e34fc58854d818ef69f16127c5c5db7fa Author: thenbrent <[email protected]> Date: Wed Jun
11 23:53:35 2014 -0700 ! Handle 'on-hold' subscriptions with limited subs For subscriptions limited to 'active' ! commit ed0063a184cbe2885dd08d28d82be55dfc0b3bab Author: thenbrent <[email protected]> Date: Wed Jun 11 23:50:16 2014 -0700 ! Squashed 'lib/action-scheduler/' changes from f2dfcb8..082b09a 082b09a Merge branch 'bleeding_branch' of github.com:thenbrent/action- scheduler into bleeding_bran 7212468 Consolidate confusing 'Run'/'Process' action links 9ab29bd Fix logic for showing AS admin screen git-subtree-dir: lib/action-scheduler git-subtree-split: 082b09a17833be5861f0295088ef19e11b47a815 -
$git log --stat -1 commit 45e9b78e34fc58854d818ef69f16127c5c5db7fa Author: thenbrent <[email protected]> Date:
Wed Jun 11 23:53:35 2014 -0700 ! Handle 'on-hold' subscriptions with limited subs For subscriptions limited to 'active' ! classes/class-wc-product-subscription.php | 2 +- classes/class-wc-product-variable-subscription.php | 2 +- templates/single-product/add-to-cart/subscription.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) -
$git log v2.1.8...v2.1.9 --oneline de27bb7 TX update 4e2c6c8 readme f8be405
Update class-wc-validation.php 2b8b483 Grunt/pot/tx 4eda361 Readme a1c0b77 normalized the woocommerce_email_attachments filter return type 0e102a0 fixed some coding standards in includes/class-wc-ajax.php 19625d1 Fix notice when not scanning any files Closes #5465 c5c81c0 Check if term is returned before getting its name a059290 Update class-wc-meta-box-coupon-data.php 10c1a18 Uttaranchal (UT) renamed to Uttarakhand (UK) c945e5a Conflict 4a63bb1 Brackets f68f278 Brahmanbaria & Habiganj missing from the list 484b492 Cleaned up logic in email_instructions functions for @splashingpixels 025f06a Use WP SEO class method rather than deprecated fn 1f12370 defined a min value to cart quantity input fcfaff1 hide number input buttons in firefox 29 and later d8ac99d COD: check if cart is available before checking if it needs shipping ad5e6a4 param comment Fixes #5408 b6c4d9a Trim commas and empty lines off address formats Fixes #5411 616542b Revise how variation attributes are deleted/updated 121022a Add $package to is_available shipping method hooks debe308 Closes #5424 15b10ca Update abstract-wc-shipping-method.php a2759cb COD: no need to hide in admin 27b302b Fix fee/coupon lines typo in REST API order response 97e0449 Stop sending line items to Mijireh Fixes #5365 -
$git diff v2.1.8...v2.1.9 diff --git a/assets/css/woocommerce.css b/assets/css/woocommerce.css index 95531a0..e5d48a1 100644
--- a/assets/css/woocommerce.css +++ b/assets/css/woocommerce.css @@ -1 +1 @@ -.clear{clear:both}.nobr{white-space:nowrap}@font-face{font-family:star;src:url(../fonts/star.eot);src:url( \ No newline at end of file +.clear{clear:both}.nobr{white-space:nowrap}@font-face{font-family:star;src:url(../fonts/star.eot);src:url( \ No newline at end of file diff --git a/assets/css/woocommerce.less b/assets/css/woocommerce.less index ee357de..0d23cce 100644 --- a/assets/css/woocommerce.less +++ b/assets/css/woocommerce.less @@ -683,6 +683,7 @@ p.demo_store { .inset_box_shadow( 0, 0, 2px, 0, @secondary ); font-weight:bold; .border_radius_left(2px); + -moz-appearance: textfield; /* Hide buttons for Firefox 29 and later */ } /* Hide buttons for opera */ @@ -1849,4 +1850,4 @@ p.demo_store { } } } -} \ No newline at end of file +} diff --git a/i18n/languages/woocommerce-admin-bg_BG.mo b/i18n/languages/woocommerce-admin-bg_BG.mo index 6c976c2..025c10f 100644 Binary files a/i18n/languages/woocommerce-admin-bg_BG.mo and b/i18n/languages/woocommerce-admin-bg_BG.mo differ diff --git a/i18n/languages/woocommerce-admin-bg_BG.po b/i18n/languages/woocommerce-admin-bg_BG.po index b09a278..0eaf03d 100644 --- a/i18n/languages/woocommerce-admin-bg_BG.po +++ b/i18n/languages/woocommerce-admin-bg_BG.po -
Replication Character Trademarks & Copyright © 1941-2014 Marvel Characters, Inc.
ALL RIGHTS RESERVED. Source: http://marvel.wikia.com/James_Madrox_(Earth-616) -
$git clone [email protected]:woothemes/woocommerce.git Cloning into 'woocommerce'... remote: Reusing existing pack:
53925, done. remote: Counting objects: 52, done. remote: Compressing objects: 100% (52/52), done. remote: Total 53977 (delta 25), reused 0 (delta 0) Receiving objects: 100% (53977/53977), 81.17 MiB | 1.85 MiB/s, done. Resolving deltas: 100% (39662/39662), done. Checking connectivity... done. copy remote repo -
$git branch * master $git branch issue/12358 $git branch issue/12358
* master intra-repository replication -
$git branch * master $git branch issue/12358 $git branch issue/12358
* master $git checkout issue/12358 $git branch issue/12358 * master intra-repository replication -
$git branch * master $git checkout -b issue/12358 $git branch
* issue/12358 master intra-repository replication -
$git branch * master $git checkout -b issue/12358 $git branch
feature/order_factory feature/create_order_function issue/132135 issue/12358 master version/2.1.1 version/2.1.2 version/2.1.2 intra-repository replication -
Character Trademarks & Copyright © 1941-2014 Marvel Characters, Inc. ALL
RIGHTS RESERVED. Source: http://powerlisting.wikia.com/wiki/File:MultipleMan.jpg Which Branch am I ?! -
(master)$git branch * master (master)$git branch issue/358 (master)$git checkout issue/358
(issue/358)$git checkout master (master)$git checkout -b feature/orderfactory (feature/orderfactory)$ Git Aware Prompt -
Unification Character Trademarks & Copyright © 1941-2014 Marvel Characters, Inc.
ALL RIGHTS RESERVED. Source: http://marvel.wikia.com/James_Madrox_(Earth-616) -
(issue/358)$git log --oneline c7410a1 send proper status codes on die
4812248 Sends proper HTTP Status Codes on die (issue/358)$git checkout master (master)$git merge issue/358 Updating 1274ac3.. 4812248 Fast-forward includes/admin/class-wc-admin-notices.php | 4 +- includes/admin/class-wc-admin-settings.php | 6 +- includes/admin/class-wc-admin-taxonomies.php | 4 +- 3 files changed, 14 insertions(+), 14 deletions(-) (master)$ Merging Replicas -
(issue/358)$git log --oneline c7410a1 send proper status codes on die
4812248 Sends proper HTTP Status Codes on die (issue/358)$git checkout master (master)$git cherry-pick 4812248 [master bfad908] Sends proper HTTP Status Codes on die (master)$ Cherry Picking -
Interdimensional Eidetic Memory Character Trademarks & Copyright © 1941-2014 Marvel
Characters, Inc. ALL RIGHTS RESERVED. Source: http://en.wikipedia.org/wiki/File:Xav-lopr.png -
$git reflog 61a946c HEAD@{0}: checkout: moving from 1557151babc01af7954c to 2.1.11
61a946c HEAD@{1}: checkout: moving from master to v2.1.11 92e98be HEAD@{2}: checkout: moving from 2.1.11 to master 61a946c HEAD@{3}: checkout: moving from 2.1.9 to 2.1.11 de27bb7 HEAD@{4}: checkout: moving from 2.1.7 to 2.1.9 da07586 HEAD@{5}: checkout: moving from master to 2.1.7 92e98be HEAD@{6}: checkout: moving from dd0b50c2647b8f7c94a to master dd0b50c HEAD@{7}: checkout: moving from 2.1.7 to v2.0.20 da07586 HEAD@{8}: checkout: moving from master to 2.1.7 92e98be HEAD@{9}: pull woothemes master: Fast-forward ebb6af9 HEAD@{10}: checkout: moving from 2.1.6 to master 95065b6 HEAD@{11}: checkout: moving from master to 2.1.6 ebb6af9 HEAD@{12}: pull: Fast-forward c7e6a77 HEAD@{13}: checkout: moving from 2.1.5 to master f38119b HEAD@{14}: checkout: moving from master to 2.1.5 c7e6a77 HEAD@{15}: commit: Add wc_cart_totals_taxes_total_html() 49be799 HEAD@{16}: commit: Add 'woocommerce_cart_taxes_total' filter 0dcfb79 HEAD@{17}: checkout: moving from 2.1.5 to master f38119b HEAD@{18}: checkout: moving from master to 2.1.5 0dcfb79 HEAD@{19}: pull: Fast-forward ! -
$git reflog 61a946c HEAD@{0}: checkout: moving from 1557151babc01af7954c to 2.1.11
61a946c HEAD@{1}: checkout: moving from master to v2.1.11 92e98be HEAD@{2}: checkout: moving from 2.1.11 to master 61a946c HEAD@{3}: checkout: moving from 2.1.9 to 2.1.11 de27bb7 HEAD@{4}: checkout: moving from 2.1.7 to 2.1.9 da07586 HEAD@{5}: checkout: moving from master to 2.1.7 92e98be HEAD@{6}: checkout: moving from dd0b50c2647b8f7c94a to master dd0b50c HEAD@{7}: checkout: moving from 2.1.7 to v2.0.20 da07586 HEAD@{8}: checkout: moving from master to 2.1.7 92e98be HEAD@{9}: pull woothemes master: Fast-forward ebb6af9 HEAD@{10}: checkout: moving from 2.1.6 to master 95065b6 HEAD@{11}: checkout: moving from master to 2.1.6 ebb6af9 HEAD@{12}: pull: Fast-forward c7e6a77 HEAD@{13}: checkout: moving from 2.1.5 to master f38119b HEAD@{14}: checkout: moving from master to 2.1.5 c7e6a77 HEAD@{15}: commit: Add wc_cart_totals_taxes_total_html() 49be799 HEAD@{16}: commit: Add 'woocommerce_cart_taxes_total' filter 0dcfb79 HEAD@{17}: checkout: moving from 2.1.5 to master f38119b HEAD@{18}: checkout: moving from master to 2.1.5 0dcfb79 HEAD@{19}: pull: Fast-forward ! Y our Undo Button For Git -
absorb powers of others Trademarks & Copyright © NBCUniversal, Inc.
ALL RIGHTS RESERVED. Source: http://heroeswiki.com/File:The_Man_with_the_Golden_Gun.jpg -
absorb the powers and psyche of others Character Trademarks &
Copyright © 1941-2014 Marvel Characters, Inc. ALL RIGHTS RESERVED. Source: http://en.wikipedia.org/wiki/Rogue_(comics)#mediaviewer/File:Rogue2CoverByMikeWieringo.jpg.gif -
Rewrite History Trademarks & Copyright © NBCUniversal, Inc. ALL RIGHTS
RESERVED. Source: http://yattaaaaa.com/ -
$git log --pretty=oneline -1 ebd01ab1e7ee796b2cdfe164 Update pto file $git commit
--amend [master 4f0ae43] Update pot file 1 file changed, 434 insertions(+), 421 deletions(-) -
Rewind Time Character Copyright © 2014 Channel Four Television Corporation
Source: http://lyra-journal.blog.cz/1301/misfits-1-serie-2009 -
1 pick 03bb047 Semantics 2 pick 45e9b78 Handle 'on-hold' subscriptions
with limited subs 3 pick 0f58231 Remove "Renewal of ..." on cart renewals 4 pick a0a17b6 Set v1.5.4 ready for release 5 pick ebd01ab Update pot file 6 7 # Rebase ca570b9..ebd01ab onto ca570b9 8 # 9 # Commands: 10 # p, pick = use commit 11 # r, reword = use commit, but edit the commit message 12 # e, edit = use commit, but stop for amending 13 # s, squash = use commit, but meld into previous commit 14 # f, fixup = like "squash", but discard this commit's log message 15 # x, exec = run command (the rest of the line) using shell 16 # -
1 reword 03bb047 Semantics 2 pick 45e9b78 Handle 'on-hold' subscriptions
with limited subs 3 edit 0f58231 Remove "Renewal of ..." on cart renewals 4 pick a0a17b6 Set v1.5.4 ready for release 5 pick ebd01ab Update pot file 6 7 # Rebase ca570b9..ebd01ab onto ca570b9 8 # 9 # Commands: 10 # p, pick = use commit 11 # r, reword = use commit, but edit the commit message 12 # e, edit = use commit, but stop for amending 13 # s, squash = use commit, but meld into previous commit 14 # f, fixup = like "squash", but discard this commit's log message 15 # x, exec = run command (the rest of the line) using shell 16 # -
cerebro for your code’s History Character Trademarks & Copyright ©
1941-2014 Marvel Characters, Inc. ALL RIGHTS RESERVED. Source: http://next2012.webs.com/apps/photos/photo?photoID=169859383 -
$git bisect start $git bisect bad $git bisect good v2.0.20
Bisecting: a merge base must be tested [8ec3ee7a855841582068226d46802f84b9b6328c] 2.0.12 version bump -
$git bisect start $git bisect bad $git bisect good v2.0.20
Bisecting: a merge base must be tested [8ec3ee7a855841582068226d46802f84b9b6328c] 2.0.12 version bump $git bisect good Bisecting: 1751 revisions left to test after this (roughly 11 steps) [70a5004ff90b7470d5f498e8780bfc28656c054e] Merge pull request #4512 from claudiosmweb/fix_4509 $ -
$git blame -w includes/wc-notice-functions.php 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42
+0100 1) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 2) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 3) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 4) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 5) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 6) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 7) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 8) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 9) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 10) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 11) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 12) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 13) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 14) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 15) 376c2f26 includes/wc-notice-functions.php (thenbrent 2013-11-13 15:56:01 -0800 16) 376c2f26 includes/wc-notice-functions.php (thenbrent 2013-11-13 15:56:01 -0800 17) b3aad6f6 includes/wc-notice-functions.php (thenbrent 2013-11-12 16:16:27 -0800 18) 376c2f26 includes/wc-notice-functions.php (thenbrent 2013-11-13 15:56:01 -0800 19) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 20) 17167288 includes/wc-message-functions.php (Mike Jolley 2013-06-11 15:59:42 +0100 21) b3aad6f6 includes/wc-notice-functions.php (thenbrent 2013-11-12 16:16:27 -0800 22) b3aad6f6 includes/wc-notice-functions.php (thenbrent 2013-11-12 16:16:27 -0800 23) -
All Marvel characters and the distinctive likeness(es) thereof are Trademarks
& Copyright © 2005 Marvel Characters, Inc. ALL RIGHTS RESERVED.