let s learn
play

Lets Learn dwayne@pantheon.io Git. @mcdwayne on Twitter No - PowerPoint PPT Presentation

Lets Learn dwayne@pantheon.io Git. @mcdwayne on Twitter No Excuses! Slides at mcdwayne.com Marketers and developers build, host, and manage their most important websites on Pantheon @mcdwayne Uploads DocV2.txt at


  1. Let’s Learn dwayne@pantheon.io Git. @mcdwayne on Twitter No Excuses! Slides at mcdwayne.com

  2. ● ● ●

  3. Marketers and developers build, host, and manage their most important websites on Pantheon

  4. @mcdwayne

  5. Uploads DocV2.txt at 11:59 Uploads DocV2.txt at 11:58 @mcdwayne

  6. Command+Z is not a strategy

  7. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and effjciency.

  8. Created by Linus Torvalds in 2005 for development of the Linux kernel

  9. Maintained since 2005 by Junio Hamano

  10. Knowledge Worker Anyone working with items that will be saved, then modified and saved again NOT JUST FOR DEVS @mcdwayne

  11. Basic idea: The document is created The document is saved The document is edited The changes are saved

  12. Keep track of every time modifications are saved. Include a history of the state of the document before and after the modification. Provide you, the author or editor, with the opportunity to add a note explaining the nature of each change. https://premium.wpmudev.org/blog/git-for-wordpress-development/

  13. Really though: The project is created The project is saved The project is edited The project changes are saved

  14. The Basics Of Time Travel Git

  15. Graphical Based

  16. Everything is local... Everything

  17. Git is lightweight

  18. Git is NOT a backup tool

  19. There are a LOT of community resources And very well documented

  20. Install Git https://git-scm.com Download git for OSX Download git for Windows Download git for Linux @mcdwayne

  21. Git CLI

  22. Git GUI

  23. Create a Repo Create a new repo locally git init @mcdwayne

  24. Create a Repo Create a new repo locally git init @mcdwayne

  25. @mcdwayne

  26. See what is going on (you will use this often) List which fi files are staged, git status unstaged, and untracked @mcdwayne

  27. See what is going on (you will use this often) List which fi files are staged, git status unstaged, and untracked @mcdwayne

  28. @mcdwayne

  29. Add fi files to the staging area Add individual fi files git add filename @mcdwayne

  30. Add fi files to the staging area Add individual fi files git add filename @mcdwayne

  31. Add fi files to the staging area Add all the fi files git add . @mcdwayne

  32. Add fi files to the staging area Add all the fi files git add . @mcdwayne

  33. Commit things to the repository Make an offj ffjcial record of the git commit -m “message” change in your history @mcdwayne

  34. Commit things to the repository Make an offj ffjcial record of the git commit -m “message” change in your history @mcdwayne

  35. The vi editor - you will eventually run into it If you don’t use -m “message” you ‘i’ to insert then esc ‘:wq’ to write & quit get dropped into vi editor @mcdwayne

  36. The vi editor - you will eventually run into it If you don’t use -m “message” you ‘i’ to insert then esc ‘:wq’ to write & quit get dropped into vi editor @mcdwayne

  37. When you have modifi fied a fi file, repeat add and commit @mcdwayne

  38. See all changes over time Display entire commit history git log @mcdwayne

  39. See all changes over time Display entire commit history git log (--oneline) @mcdwayne

  40. See all changes over time Display entire commit history git log (--oneline) @mcdwayne

  41. See all what changed in your working directory Show what changed where git diff @mcdwayne

  42. See all what changed in your working directory Show what changed where git diff @mcdwayne

  43. @mcdwayne

  44. Undoing things (safe) Let’s undo a specifi fic commit git revert <commit ID> @mcdwayne

  45. Undoing things (safe) Let’s undo a specifi fic commit git revert <commit ID> @mcdwayne

  46. Undoing things (safe) Let’s undo a specifi fic commit even git revert <commit ID> reverts! @mcdwayne

  47. Undoing things (safe) Let’s undo a specifi fic commit even git revert <commit ID> reverts! @mcdwayne

  48. Undoing things (dangerous) Let’s go backwards in time and forget git reset --hard <commit ID> everything after that point @mcdwayne

  49. Undoing things (dangerous) Let’s go backwards in time and forget git reset --hard <commit ID> everything after that point @mcdwayne

  50. @mcdwayne

  51. Working with branches @mcdwayne

  52. Working with branches See what exists and git branch (newBranchName) create a new one @mcdwayne

  53. Working with branches See what exists and git branch (newBranchName) create a new one @mcdwayne

  54. Working with branches Switch between branches git checkout branchname @mcdwayne

  55. Working with branches Switch between branches git checkout branchname @mcdwayne

  56. Working with branches Your changes in a branch are not git branch refl flected in ‘master’ @mcdwayne

  57. Working with branches Your changes in a branch are not git branch refl flected in ‘master’ @mcdwayne

  58. Working with merging Merging branches, make sure you git merge branchToMergeIn are on master fi first @mcdwayne

  59. Working with merging Merging branches, make sure you git merge branchToMergeIn are on master fi first @mcdwayne

  60. Merge Confl flicts This will happen sometimes git merge branchToMergeIn Changes confl flict, looks like this @mcdwayne

  61. Merge Confl flicts Git tries to fi fix things and shows you git merge where it went bad @mcdwayne

  62. Merge Confl flicts Git tries to fi fix things and shows you git merge where it went bad @mcdwayne

  63. Merge Confl flicts There are built tools you can have git mergetool git run to help fi fix confl flicts @mcdwayne

  64. Remote repositories @mcdwayne

  65. Remote repositories @mcdwayne

  66. @mcdwayne

  67. Let’s add a remote repository Name the remote (origin) and git remote add address of the online repo @mcdwayne

  68. Let’s add a remote repository Name the remote (origin) and git remote add address of the online repo @mcdwayne

  69. Let’s add a remote repository Name the remote (origin) and git remote add address of the online repo @mcdwayne

  70. Let’s push to a remote repository Name the remote (origin) and name git push of branch (master) git push origin master git push origin branch git push other-remote branch @mcdwayne

  71. Let’s push to a remote repository Name the remote (origin) and name git push of branch (master) @mcdwayne

  72. Let’s push to a remote repository Name the remote (origin) and name git push of branch (master) @mcdwayne

  73. Let’s pull changes into our repository Using Github’s editor and pulling Editing on Github changes locally @mcdwayne

  74. Let’s pull changes into our repository Using Github’s editor and pulling git pull changes locally @mcdwayne

  75. Let’s pull changes into our repository Using Github’s editor and pulling git pull changes locally @mcdwayne

  76. Let’s push local back up again Name the remote (origin) and name git push of branch (master) @mcdwayne

  77. Let’s push local back up again Name the remote (origin) and name git push of branch (master) @mcdwayne

  78. We can clone a copy locally from any remote repository We just need to specify where from git clone and it creates the folder @mcdwayne

  79. We can clone a copy locally from any remote repository We just need to specify where from git clone and it creates the folder @mcdwayne

  80. Enter the Pull Request! This is is branching and collaboration in one concept @mcdwayne

  81. Enter the Pull Request! @mcdwayne

  82. Anyone with push access to the repository can complete the merge. Normally this is assigned to the repo owner. Repository @mcdwayne

  83. What I memorized git init git status git add git commit git log git diff git revert git reset git branch git checkout git merge git remote git push git pull git clone @mcdwayne

  84. For everything else! @mcdwayne

  85. 100s of ‘how to’ guides and docs Offjcial Documents: https://git-scm.com/doc https://guides.github.com/introduction/flow/ Articles I Like: https://calderaforms.com/2015/09/who-should-be-using-version-control-for-wordpress-development/ https://premium.wpmudev.org/blog/git-for-wordpress-development/ https://www.sitepoint.com/wordpress-version-control-git/ http://www.makeuseof.com/tag/git-version-control-youre-developer/ https://blog.wppusher.com/demystifying-git-for-wordpress-developers/ https://wptavern.com/git-and-wordpress-3-tips-to-do-it-better Cheat Sheets! https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet https://www.git-tower.com/blog/git-cheat-sheet/ Fixing things: https://sethrobertson.github.io/GitFixUm/fixup.html http://ohshitgit.com/ @mcdwayne

  86. ● ● ●

Recommend


More recommend