Less 'Oh Shit' With GIT

748 views
641 views

Published on

First presented at the Manchester WordPress User Group on 16th May 2012.

Outlines what a workflow is, why it's important to have one, explains what mine is. Actual presentation had a live demo. (This is the KeyNote presentation rather than a flat PDF)

Published in: Technology, Career
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
748
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Less 'Oh Shit' With GIT

    1. 1. Less ‘Oh Sh*t’ With GITHow having a GIT-based workflow can make your life infinitely easier
    2. 2. What with a who-now? 2
    3. 3. What with a who-now? • Who the hell are you? • What the hell are you talking about? • What the hell is a ‘Workflow’ ? • What the hell is ‘GIT’? • Oh. Why the hell am I not using this thing? 2
    4. 4. Who the hell are you? 3
    5. 5. Who the hell are you? 3
    6. 6. Who the hell are you? • Richard Tape 3
    7. 7. Who the hell are you? • Richard Tape • Sticky, sello, masking, video, worm. You’re welcome 3
    8. 8. Who the hell are you? • Richard Tape • Sticky, sello, masking, video, worm. You’re welcome • Working with WP professionally for >3 years. Thanks Mike! 3
    9. 9. Who the hell are you? • Richard Tape • Sticky, sello, masking, video, worm. You’re welcome • Working with WP professionally for >3 years. Thanks Mike! • @RichardTape 3
    10. 10. Who the hell are you? • Richard Tape • Sticky, sello, masking, video, worm. You’re welcome • Working with WP professionally for >3 years. Thanks Mike! • @RichardTape • http://rich.is/ (coming soon) but have site at http://iamfriendly.com/ 3
    11. 11. 4
    12. 12. 4
    13. 13. !important 4
    14. 14. !important • Here’s what I’m not saying: 4
    15. 15. !important • Here’s what I’m not saying: ★ That my WorkFlow is the One True Way © 4
    16. 16. !important • Here’s what I’m not saying: ★ That my WorkFlow is the One True Way © ★ That what I do is ‘right’ 4
    17. 17. !important • Here’s what I’m not saying: ★ That my WorkFlow is the One True Way © ★ That what I do is ‘right’ ★ That you should copy what I do without having a basic understanding of what you’re doing 4
    18. 18. !important • Here’s what I’m not saying: ★ That my WorkFlow is the One True Way © ★ That what I do is ‘right’ ★ That you should copy what I do without having a basic understanding of what you’re doing ★ Manchester City deserved to win the Premiership Title this year 4
    19. 19. 5
    20. 20. What the hell are you talkingabout, then? 5
    21. 21. What the hell are you talkingabout, then?• What is a Workflow and why do I need one? 5
    22. 22. What the hell are you talkingabout, then?• What is a Workflow and why do I need one?• Richard, what were you doing this time last year? 5
    23. 23. What the hell are you talkingabout, then?• What is a Workflow and why do I need one?• Richard, what were you doing this time last year?• Haha. That’s ridiculous. You’re an idiot. What are you doing now, though? 5
    24. 24. What the hell are you talkingabout, then?• What is a Workflow and why do I need one?• Richard, what were you doing this time last year?• Haha. That’s ridiculous. You’re an idiot. What are you doing now, though?• But I already have my way of doing things and it works great. When do you stop talking? You’re boring. 5
    25. 25. What the hell are you talkingabout, then?• What is a Workflow and why do I need one?• Richard, what were you doing this time last year?• Haha. That’s ridiculous. You’re an idiot. What are you doing now, though?• But I already have my way of doing things and it works great. When do you stop talking? You’re boring.• OK, OK, as it’d apparently be ‘rude’ if I got up and left, you might as well tell me about this ‘GIT’ thing. ENTERTAIN ME. 5
    26. 26. 6
    27. 27. What is a Workflow? 6
    28. 28. What is a Workflow?You’re going to crack out a dictionary definition aren’t you?You’re so predictable. 6
    29. 29. What is a Workflow?You’re going to crack out a dictionary definition aren’t you?You’re so predictable.1. The scheduling of independent jobs on a computer. 6
    30. 30. What is a Workflow?You’re going to crack out a dictionary definition aren’t you?You’re so predictable.1. The scheduling of independent jobs on a computer.2.  The set of relationships between all the activities in aproject, from start to finish. Activities are related by differenttypes of trigger relation. Activities may be triggered byexternal events or by other activities. 6
    31. 31. What is a Workflow?You’re going to crack out a dictionary definition aren’t you?You’re so predictable.1. The scheduling of independent jobs on a computer.2.  The set of relationships between all the activities in aproject, from start to finish. Activities are related by differenttypes of trigger relation. Activities may be triggered byexternal events or by other activities.3. The movement of documents around an organisation forpurposes including sign-off, evaluation, performing activitiesin a process and co-writing. 6
    32. 32. 7
    33. 33. And in English, please? 7
    34. 34. And in English, please?How you go about your day-to-day tasks and the systems you put inplace to allow you to do those tasks more easily 7
    35. 35. 8
    36. 36. Richard, what were you doingthis time last year? 8
    37. 37. Richard, what were you doingthis time last year?• Work locally using a MAMP setup. 8
    38. 38. Richard, what were you doingthis time last year?• Work locally using a MAMP setup.• WordPress Multisite installation, each ‘project’ was a new site. 8
    39. 39. Richard, what were you doingthis time last year?• Work locally using a MAMP setup.• WordPress Multisite installation, each ‘project’ was a new site.• When happy with work, sFTP to live site. Cross fingers and sacrifice a goat in the hope that it wouldn’t break. 8
    40. 40. Richard, what were you doingthis time last year?• Work locally using a MAMP setup.• WordPress Multisite installation, each ‘project’ was a new site.• When happy with work, sFTP to live site. Cross fingers and sacrifice a goat in the hope that it wouldn’t break.• For edits: either edit file locally and re-upload or, if I was in a rush, edit the file on the live server. Yes, I’m going straight to hell. 8
    41. 41. Richard, what were you doingthis time last year?• Work locally using a MAMP setup.• WordPress Multisite installation, each ‘project’ was a new site.• When happy with work, sFTP to live site. Cross fingers and sacrifice a goat in the hope that it wouldn’t break.• For edits: either edit file locally and re-upload or, if I was in a rush, edit the file on the live server. Yes, I’m going straight to hell.• For database: local and live sites were entirely separate. 8
    42. 42. Live fileediting?
    43. 43. Live fileediting?
    44. 44. Live fileediting?Hahaha. HAHAHAHA.AAAAHAHAHAHAHA.You’re an idiot.(Secretly, I sometimes do this too. But don’t tellanyone)
    45. 45. 11
    46. 46. What are you doing now? 11
    47. 47. What are you doing now?• All source files (including WP core) are version controlled in GIT - stored in local repos and on github 11
    48. 48. What are you doing now?• All source files (including WP core) are version controlled in GIT - stored in local repos and on github• I make all edits locally (even though I am sysadmin on my live server, I have intentionally revoked my rights to edit files directly) 11
    49. 49. What are you doing now?• All source files (including WP core) are version controlled in GIT - stored in local repos and on github• I make all edits locally (even though I am sysadmin on my live server, I have intentionally revoked my rights to edit files directly)• Commit to local git repo. Push to github. 11
    50. 50. What are you doing now?• All source files (including WP core) are version controlled in GIT - stored in local repos and on github• I make all edits locally (even though I am sysadmin on my live server, I have intentionally revoked my rights to edit files directly)• Commit to local git repo. Push to github.• Post Commit hooks on github automatically pulls all edits onto staging server 11
    51. 51. What are you doing now?• All source files (including WP core) are version controlled in GIT - stored in local repos and on github• I make all edits locally (even though I am sysadmin on my live server, I have intentionally revoked my rights to edit files directly)• Commit to local git repo. Push to github.• Post Commit hooks on github automatically pulls all edits onto staging server• If happy on staging, deploy changes to live 11
    52. 52. 12
    53. 53. GIT? Repo? Staging? Deploy? 12
    54. 54. GIT? Repo? Staging? Deploy?• GIT is a VCS - a version control system (a ‘distributed’ one at that) and source code management (SCM) ★ It keeps track of all changes you make to your files ★ You can think of it like the Revisions System in WordPress 12
    55. 55. GIT? Repo? Staging? Deploy?• GIT is a VCS - a version control system (a ‘distributed’ one at that) and source code management (SCM) ★ It keeps track of all changes you make to your files ★ You can think of it like the Revisions System in WordPress• Repo is short for Repository. ★ It’s sort of like a database ★ When you make changes to your files, you ‘commit’ them to your local repo ★ If you have made a mistake, you can simply ‘roll back’ to a previous state ★ Sort of like an ‘undo’ feature for all of your files 12
    56. 56. GIT? Repo? Staging? Deploy? 13
    57. 57. GIT? Repo? Staging? Deploy?• Staging ★ An intermediary between your local environment and the live site ★ Ideally, the staging server and the live server have identical setups ★ Means you can see exactly what your changes will look like on the live site without the panic of ‘guessing’ 13
    58. 58. GIT? Repo? Staging? Deploy?• Staging ★ An intermediary between your local environment and the live site ★ Ideally, the staging server and the live server have identical setups ★ Means you can see exactly what your changes will look like on the live site without the panic of ‘guessing’• Deploy ★ The equivalent of FTP’ing all your changes elsewhere ★ When you ‘deploy’ something you’re effectively “making it live” 13
    59. 59. 14
    60. 60. Hang on. So you don’t FTP?Anything? 14
    61. 61. Hang on. So you don’t FTP?Anything?• Nope. Not a sausage. 14
    62. 62. Hang on. So you don’t FTP?Anything?• Nope. Not a sausage.• If I need to install a plugin I do it locally. Then commit and push to github. 14
    63. 63. Hang on. So you don’t FTP?Anything?• Nope. Not a sausage.• If I need to install a plugin I do it locally. Then commit and push to github.• This then automatically grabs all files to the staging server (which means FTP is disabled on my server so (a little) more secure. 14
    64. 64. Hang on. So you don’t FTP?Anything?• Nope. Not a sausage.• If I need to install a plugin I do it locally. Then commit and push to github.• This then automatically grabs all files to the staging server (which means FTP is disabled on my server so (a little) more secure.• Likewise with themes. 14
    65. 65. Iiiinteresting. Veeeeryinteresting. 15
    66. 66. 16
    67. 67. OK smart-arse, what aboutcontent? 16
    68. 68. OK smart-arse, what aboutcontent?• Content is a little more complicated 16
    69. 69. OK smart-arse, what aboutcontent?• Content is a little more complicated• Text is stored in a database, so no ‘flat files’ as such (there is, kinda, but it’s complicated and not for now) 16
    70. 70. OK smart-arse, what aboutcontent?• Content is a little more complicated• Text is stored in a database, so no ‘flat files’ as such (there is, kinda, but it’s complicated and not for now)• Can do a ‘database dump’ change references to ‘local’ environment and replace with links to live site 16
    71. 71. OK smart-arse, what aboutcontent?• Content is a little more complicated• Text is stored in a database, so no ‘flat files’ as such (there is, kinda, but it’s complicated and not for now)• Can do a ‘database dump’ change references to ‘local’ environment and replace with links to live site• Or... 16
    72. 72. OK smart-arse, what aboutcontent?• Content is a little more complicated• Text is stored in a database, so no ‘flat files’ as such (there is, kinda, but it’s complicated and not for now)• Can do a ‘database dump’ change references to ‘local’ environment and replace with links to live site• Or...• RAMP Plugin by Crowd Favorite http://crowdfavorite.com/wordpress/ramp/ 16
    73. 73. 17
    74. 74. 17
    75. 75. 18
    76. 76. Holy Frack. How Much?! 18
    77. 77. Holy Frack. How Much?!• Yeah, it’s not cheap. But it does a great job. 18
    78. 78. Holy Frack. How Much?!• Yeah, it’s not cheap. But it does a great job.• Also, it has a developer API, so all of the themes and plugins that I develop are ‘RAMP-enabled’ which mean that any user of said themes or plugins can benefit from RAMP’s content management 18
    79. 79. Holy Frack. How Much?!• Yeah, it’s not cheap. But it does a great job.• Also, it has a developer API, so all of the themes and plugins that I develop are ‘RAMP-enabled’ which mean that any user of said themes or plugins can benefit from RAMP’s content management• Free Alternative: DeployMint by Mark Maunder http://code.google.com/p/deploymint/ 18
    80. 80. Care toshow me anexample?
    81. 81. Care toshow me anexample?This can only go well
    82. 82. OH GOD!THECONSOLE
    83. 83. OH GOD!THECONSOLE• You don’t have to use the console, there are several apps you can use• Tower or github for mac• GIT Gui / TortoiseGIT for Windows
    84. 84. 21
    85. 85. 21
    86. 86. But I workin a team? 21
    87. 87. But I workin a team?• On some projects, so do I! 21
    88. 88. But I workin a team?• On some projects, so do I!• Different people have their own ‘local’ repository and work on different branches 21
    89. 89. But I workin a team?• On some projects, so do I!• Different people have their own ‘local’ repository and work on different branches• These are then ‘merged’ as and when 21
    90. 90. 22
    91. 91. What about backups? 22
    92. 92. What about backups?• Well, because your code is all stored on GitHub, you already have 1 level of backup. RAMP handles media, too. 22
    93. 93. What about backups?• Well, because your code is all stored on GitHub, you already have 1 level of backup. RAMP handles media, too.• For the database, I use a plugin called BackupPress (http:// www.getbackuppress.com) - it ‘just works’ and allows you to restore your database back to a previous state if things go awry 22
    94. 94. What about backups?• Well, because your code is all stored on GitHub, you already have 1 level of backup. RAMP handles media, too.• For the database, I use a plugin called BackupPress (http:// www.getbackuppress.com) - it ‘just works’ and allows you to restore your database back to a previous state if things go awry• Alternative: WP-DBManager (https://wordpress.org/ extend/plugins/wp-dbmanager/) 22
    95. 95. What about backups?• Well, because your code is all stored on GitHub, you already have 1 level of backup. RAMP handles media, too.• For the database, I use a plugin called BackupPress (http:// www.getbackuppress.com) - it ‘just works’ and allows you to restore your database back to a previous state if things go awry• Alternative: WP-DBManager (https://wordpress.org/ extend/plugins/wp-dbmanager/)• I also have a cron job on my server which does a dump twice a day. 22
    96. 96. 23
    97. 97. I’ve forgotten absolutelyeverything you’ve just said 23
    98. 98. I’ve forgotten absolutelyeverything you’ve just said• Having a workflow you are both comfortable with and that you stick to is more important than what the workflow actually is 23
    99. 99. I’ve forgotten absolutelyeverything you’ve just said• Having a workflow you are both comfortable with and that you stick to is more important than what the workflow actually is• Use a Version Control System; they will - after a small learning curve - become a God-send 23
    100. 100. I’ve forgotten absolutelyeverything you’ve just said• Having a workflow you are both comfortable with and that you stick to is more important than what the workflow actually is• Use a Version Control System; they will - after a small learning curve - become a God-send• Never, ever edit files on a live server. Ever. Forever, ever. 23
    101. 101. I’ve forgotten absolutelyeverything you’ve just said• Having a workflow you are both comfortable with and that you stick to is more important than what the workflow actually is• Use a Version Control System; they will - after a small learning curve - become a God-send• Never, ever edit files on a live server. Ever. Forever, ever.• Have a fallback plan 23
    102. 102. I’ve forgotten absolutelyeverything you’ve just said• Having a workflow you are both comfortable with and that you stick to is more important than what the workflow actually is• Use a Version Control System; they will - after a small learning curve - become a God-send• Never, ever edit files on a live server. Ever. Forever, ever.• Have a fallback plan• Don’t just jump straight into something - do some reading about it first, understand it, then take small steps 23
    103. 103. Credits• http://bit.ly/JDjfYd• http://bit.ly/L3Z3vL• http://bit.ly/K3NJAZ• http://bit.ly/L44VF3• http://bit.ly/JtUO25• http://bit.ly/JSTJz1• http://bit.ly/IXPLRE• http://bit.ly/Kt1NaX• http://bit.ly/J85QZK• http://bit.ly/L6md4t• http://bit.ly/LScNN4• http://bit.ly/JJdes2

    ×