git going with dvcs v1.5.1

292
by Matthew McCullough of Ambient Ideas, LLC with DVCS Git going 90 minutes of mental spoon bending via source code control

Upload: matthew-mccullough

Post on 07-May-2015

2.051 views

Category:

Education


3 download

DESCRIPTION

IASA presentation of Git talk

TRANSCRIPT

  • 1.Git goingwithDVCS mental spoo n bending 90 minutes of v ia source c ode control by Matthew McCullough of Ambient Ideas, LLC

2. DVCS 3. What? Why?Basic Use DVCS 4. What? Why?Basic UseWhos Theory DVCSUsing Git?Deeper Use 5. What?Why?Basic UseWhos Theory DVCSUsing Git?Deeper UseUsage Models GUIs High Points 6. Git -nounsant or Slang. an unplea British contemptibleper son ionar y -Oxfo rd English Dict 7. contrasts 8. otistical bastard, and I'm an eg I name all my projects after myself. Fi rst Linux, now git. -Lin us Torvalds 9. otistical bastard, and I'm an eg I name all my projects after myself. Fi rst Linux, now git. -Lin us Torvalds 10. RCSFolders 11. ClearSource Case Safe CVSPVCSRCSFolders 12. Subversion BitKeeperPerforce ClearSource Case Safe CVSPVCSRCSFolders 13. darcsMercurialBazaarSubversion BitKeeperPerforce ClearSource Case Safe CVSPVCSRCSFolders 14. t Source Code Control Gi 15. Gi Source Code Control t 16. CultureChange 17. Centralized VCS =Dont 18. Centralized VCS =Dont 19. DistributedVCS= Whatever!Do 20. Innovate 21. Experiment 22. Safely Be Wrong 23. Drive-by Assist 24. Crowd Source 25. Crowd Source 26. Crowd Source 27. Just show it to me! 28. No, not on that! 29. Download binaries 30. Git Distro Sources Win Cygwin Win msysGit 31. Git Distro Sources Win Cygwin Win msysGit Linux Source Linux Package manager 32. Git Distro Sources Win Cygwin Win msysGit Linux Source Linux Package manager Mac MacPorts Mac git-osx-installer 33. Git Distro Sources Win Cygwin Win msysGit Linux Source Linux Package manager Mac MacPorts Mac git-osx-installer Any JGit 34. Put it in your path 35. Identify yourself 36. Global Git Settings git cong --global user.name quot;Hal Smithquot;git cong --global user.email quot;[email protected]; 37. Global Git Settingsgit cong --list 38. Global Git Settingsgit cong --listt va lues t cu rren Outpu 39. Use it! 40. Creating a Repomkdir myproj.git 41. Creating a Repomkdir myproj.git cd myproj.git 42. Creating a Repomkdir myproj.git cd myproj.git git init 43. Creating a Repo! mkdir myproj.git D O N E cd myproj.git git init 44. Thanks for attending! 45. Knobs and Dials 46. 145+ Commands 47. What?Why?Basic UseWhos Theory DVCSUsing Git?Deeper UseUsage Models GUIs High Points 48. Whos Got Git? 49. Follow the DOTS 50. Symmetric 51. Symmetric 52. Distributed 53. pu sh 54. pu sh 55. push 56. push 57. pull 58. pull 59. Distributed 60. Hashes and Integrity 61. Index vs Hash Centralized VCS uses DB sequential index. Git uses SHA-1 hash. 62. SHA-1 Hash Hash for the sake of integrity. Keep the source of the hash. 63. SHA-1 Hash Hash for the sake of integrity. Keep the source of the hash. ughtI tho erees w hash r fo swo rds? pas 64. Centralized VCS 65. Alice Bob 66. AliceBob 1 = okay.htm 67. AliceBob 1 = okay.htm2 = ne.htm 68. AliceBob 1 = okay.htm2 = ne.htmsvnsync 69. AliceBob 1 = okay.htm 1 = okay.htm2 = ne.htmsvnsync 2 = ne.htm 70. Alice Bob 1 = okay.htm 1 = okay.htm2 = ne.htmsvnsync 2 = ne.htm 3 = good.htm 71. AliceBob 1 = okay.htm1 = okay.htm2 = ne.htm svnsync 2 = ne.htm3 = good.htm3 = great.htm 72. AliceBob 1 = okay.htm1 = okay.htm2 = ne.htm svnsync 2 = ne.htm3 = good.htm3 = great.htm svnsync 73. AliceBob 1 = okay.htm1 = okay.htm2 = ne.htm svnsync 2 = ne.htm4 = good.htm3 = good.htm3 = great.htm svnsync 4 = great.htm 74. AliceBob1 = okay.htm1 = okay.htm 2 = ne.htm svnsync 2 = ne.htm ERROR4 = good.htm3 = good.htm 3 = great.htm ERRORsvnsync 4 = great.htm 75. Distributed VCS 76. Alice Bob 77. AliceBob a233b76 = okay.htm 78. AliceBob a233b76 = okay.htmd234ab1 = ne.htm 79. Alice Bob a233b76 = okay.htmd234ab1 = ne.htmSync 80. AliceBob a233b76 = okay.htma233b76 = okay.htmd234ab1 = ne.htmSync d234ab1 = ne.htm 81. AliceBob a233b76 = okay.htma233b76 = okay.htmd234ab1 = ne.htmSync d234ab1 = ne.htmf90b12c = good.htm 82. AliceBob a233b76 = okay.htm a233b76 = okay.htmd234ab1 = ne.htm Sync d234ab1 = ne.htm f90b12c = good.htmae42ba0 = great.htm 83. AliceBob a233b76 = okay.htm a233b76 = okay.htmd234ab1 = ne.htm Sync d234ab1 = ne.htm f90b12c = good.htmae42ba0 = great.htm Sync 84. AliceBob a233b76 = okay.htm a233b76 = okay.htmd234ab1 = ne.htm Sync d234ab1 = ne.htmf90b12c = good.htm f90b12c = good.htmae42ba0 = great.htm Sync ae42ba0 = great.htm 85. Hashable Objects Blob Tree Commit Tag 86. http://book.git-scm.com/1_the_git_object_model.html 87. http://book.git-scm.com/1_the_git_object_model.html 88. http://book.git-scm.com/1_the_git_object_model.html 89. http://book.git-scm.com/1_the_git_object_model.html 90. Hash BenefitsIndependence Time & location separation from sequence # of checkin. Easy merging of repositories Easy identication of what needs to be synced 91. Hash BenefitsIntegrity Identies damaged repos. Prevents modication of published history. Unique to le size and contents. 92. Hash BenefitsTags Cryptographically sign tags by GPG. Guaranteeing the repos state at a point in time. 93. Location,Location,Location 94. Single Stage Thinking of Subversion 95. Subversion svn commit Adds everything modied. committed locally and on the server. Must list if you want specic les. What if you check in your password? 96. $ echo //COMMENTS >> Matt1.java $ echo //THOUGHTS >> Matt2.java 97. $ echo //COMMENTS >> Matt1.java $ echo //THOUGHTS >> Matt2.java$ svn status MMatt1.java MMatt2.java 98. $ echo //COMMENTS >> Matt1.java $ echo //THOUGHTS >> Matt2.java$ svn status MMatt1.java MMatt2.java$ svn commit -m'Matts checkin' Adding Matt1.java Adding Matt2.java Transmitting file data . Committed revision 2. 99. Three Stage Thinking of Git 100. Git git add git commit git push Commits only what is added to the index. Opportunity to change history locally. Selectively share with other repos. 101. repo git clone git://somedomain/myproj.git B uild cd myproj.git 102. repo git clone git://somedomain/myproj.git B uild cd myproj.git dex pda te in git checkout master U 103. repo git clone git://somedomain/myproj.git B uild cd myproj.git dex pda te in git checkout master Uecho //Comments >> ClassOne.java or king echo //Thoughts >> ClassTwo.java E dit w 104. repo git clone git://somedomain/myproj.gitB uild cd myproj.git dex pda te in git checkout master Uecho //Comments >> ClassOne.java or king echo //Thoughts >> ClassTwo.java E dit wto i ndex git add ClassOne.java Addepo ave to r git commit -mAdded comments S 105. repo git clone git://somedomain/myproj.git B uild cd myproj.git dex pda te in git checkout master Uecho //Comments >> ClassOne.java or king echo //Thoughts >> ClassTwo.java E dit wto i ndex git add ClassOne.java Addepo ave to r git commit -mAdded comments Sst ash git stash Pus h to 106. Remote is like a special Stash RepoIndexWorking 107. Remote is like a special Stash RepoIndexWorking 108. Remote is like a special Stash Repogit cloneIndexWorking 109. Remote is like a special Stash Repogit clonegit checkoutIndexWorking 110. Remote is like a special Stash Repogit clonegit checkoutedit experiment les IndexWorking 111. Remote is like a special Stash Repogit clonegit checkoutedit experiment lesgit stash IndexWorking 112. Remote is like a special Stash Repogit clonegit checkoutedit experiment lesgit stashtest buggy lesIndexWorking 113. Remote is like a special Stash Repogit clonegit checkoutedit experiment lesgit stashtest buggy lesIndex git stash applyWorking 114. Remote is like a special Stash Repogit clonegit checkoutedit experiment lesgit stashtest buggy lesIndex git stash applyWorking git add 115. Remote is like a special Stash Repogit clonegit checkoutedit experiment lesgit stashtest buggy lesIndex git stash applyWorking git addgit commit 116. Remote is like a special Stash Repogit clonegit checkoutedit experiment lesgit stashtest buggy lesIndex git stash applyWorking git addgit commitgit push 117. Remote is like a special Stash Repogit clonegit checkoutedit experiment lesgit stashtest buggy lesIndex git stash applyWorking git addgit commitgit push 118. What does this buy me? 119. $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt 120. $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt$ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt 121. $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt$ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt o in dex int $ git add mattfile1.txt Put 122. $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt$ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt o in dex int $ git add mattfile1.txt Put to r epo S ave $ git commit -m'Matts pw checkin' [master]: created ddcdf18: quot;Matts pw checkinquot;1 files changed, 1 insertions(+), 0 deletions(-) 123. #$%^&! I just committed my password! 124. Change History $ git reset --hard HEAD^ HEAD is now at 9de4cd3 First checkin$ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough Date: Wed Mar 4 23:09:17 2009 -0700 First checkin 125. Change History com mit the w a way $ git reset --hard HEAD^T hro HEAD is now at 9de4cd3 First checkin$ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough Date: Wed Mar 4 23:09:17 2009 -0700 First checkin 126. Change History com mit the w a way $ git reset --hard HEAD^T hro HEAD is now at 9de4cd3 First checkin$ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough Date: Wed Mar 4 23:09:17 2009 -0700 First checkin 127. Sharing 128. Serving It Up Protocols GIT SSH SCP Local le system SAMBA HTTP WebDAV rsync 129. Serving It Up Network git instaweb. Built in, read-only, HTTP. git daemon. Custom socket language. gitosis. Easy permissions control. github. Open source & private repos. ssh. OS controlled permissions. 130. Serving It UpFilesystem Local folders. Yes, they can be remotes. Mapped network drives. Just like folders. 131. aem on git clone git://somehost.org/myproj.git g it d 132. aem on git clone git://somehost.org/myproj.git g it dgit clone [email protected]:myproj.git SSH 133. aem on git clone git://somehost.org/myproj.gitg it dgit clone [email protected]:myproj.gitSSHgit clone http://somehost.org/myproj.gitH TTP 134. aem on git clone git://somehost.org/myproj.gitg it dgit clone [email protected]:myproj.gitSSHgit clone http://somehost.org/myproj.gitH TTP sys tem git clone ~/work/myproj.git File 135. aem on git clone git://somehost.org/myproj.gitg it dgit clone [email protected]:myproj.gitSSHgit clone http://somehost.org/myproj.gitH TTP sys tem git clone ~/work/myproj.git File rk d riveNe two git clone z:someservermyproj.git 136. Merge & Rebase 137. Cheap Branches 138. Cheap Branches git show-branch --all git branch -aLocal branchlocalbranchname Remoteremote/branchname 139. Merge Anything 140. Merge Anything git merge --no-commit git merge --squash git merge Selectable merge strategy Octopus: More than one Review before committing Flatten micro-checkins 141. Rebase for Clarity 142. Rebase for Clarity git checkout myfeaturebranch git rebase masterCleaner history than a merge. Fast forwards original branch. Lets you see how trunk will act before you merge. Reposition your feature branchs start point. Makes for simpler merge graphs. 143. MdaS err ta g d n e Master/Trunk/MainLatest 144. MdaS err ta g d n e Master/Trunk/MainLatest a32 145. ard Bra dn eta ga32n ch S er Master/Trunk/MainLatestM 2e2 146. ard Bra dn eta ga32n ch S er Master/Trunk/MainLatestd19M 2e2 147. ard Bra dn eta ga32n ch S er Master/Trunk/MainLatestd19M 2e2 8b3 148. ard Bra dn eta ga32n ch S er Master/Trunk/MainLatestd19M 2e2e698b3 149. ard Bra dn eta ga32n ch S er Master/Trunk/MainLatestd19M 2e2e698b3ergeM9f1 150. Rebasing Master/Trunk/MainLatest 151. Rebasing Master/Trunk/MainLatest a32 152. Rebasing Master/Trunk/MainLatesta32 2e2 Brachn 153. Bra sing a32 n ch ba Master/Trunk/MainLatest Re 2e2 d19 154. Bra sing a32 n ch ba Master/Trunk/MainLatest Re 2e2 d19 8b3 155. Bra sing a32 n ch ba Master/Trunk/MainLatest Re 2e2 d19 8b3e69 156. Master/Trunk/MainLatesta322e28b3Brach n d19 e69 Rebase 157. a32 Master/Trunk/MainLatest 2e28b3 Bran chd19 d19Merge e69 e69 158. WorkingOffline 159. Offline AnythingCheckin 160. Offline AnythingCheckinAddBranchList change logGrep historyRewrite historyStashMergeLabelRemove 161. Offline AnythingCheckinAddBranchList change logGrep historyRewrite historyStashMergeLabelRemovepractically everything but push 162. Offline AnythingCheckinAddBranchList change logGrep historyRewrite historyStashMergeLabelRemovepractically everything but push 163. Hooray! Another checkin to my latest OSS project! 164. Hooray! Anothercheckin to my latest OSSproject!I think I liked subversion better... 165. Speed 166. git: git hg: mercurial bzr: bazaar 167. Init Add Status Diff Branch (Cold/Hot) git hg bzr git hgbzr git hg bzr git hg bzrTagLog Commit (Lg)Commit (Sm)git cgit hhg c hg h bzr c bzr h git hg bzr git hgbzr git hg bzr git hg bzrdata from http://whygitisbetterthanx.com/#git-is-fast 168. 10to100 timesFaster 169. VCS Interop 170. Subversion git svn clone http://unfurl.com/trunk git svn dcommit 171. Subversion git svn clone http://unfurl.com/trunk git svn dcommit First class compatibility. 172. Subversion git svn clone http://unfurl.com/trunk git svn dcommit First class compatibility. Round trip support. 173. Subversion git svn clone http://unfurl.com/trunk git svn dcommit First class compatibility. Round trip support. Git commits = svn commits. 174. Migration git svn clone 175. Migration git svn clone Power off your Subversion server. 176. What?Why?Basic UseWhos Theory DVCSUsing Git?Deeper UseUsage Models GUIs High Points 177. UsageModels 178. Centralized CentralRepo 179. Centralized CentralRepo 180. RepoBlessed Dictatorship 181. RepoBlessed Dictatorship 182. RepoBlessed Dictatorship 183. RepoBlessed Dictatorship 184. RepoBlessed Dictatorship 185. CertiedIntegration ManagedDevelopmentRepo Repo 186. CertiedIntegration ManagedDevelopmentRepo Repo 187. CertiedIntegration ManagedDevelopmentRepo Repo 188. CertiedIntegration ManagedDevelopmentRepo Repo 189. Mirror MirrorCertied DevelopmentRepo Repo Mirrored 190. Mirror MirrorCertied DevelopmentRepo Repo Mirrored 191. Mirror MirrorCertied DevelopmentRepo Repo Mirrored 192. Mirror MirrorCertied DevelopmentRepo Repo Mirrored 193. Mirror MirrorCertied DevelopmentRepo Repo Mirrored 194. PrivatePublic GitHub Custom + Public Contrib 195. PrivatePublic GitHub Custom + Public Contrib 196. Private Public Customized GitHub Custom + Public Contrib 197. Private Public Customized GitHub Custom + Public Contrib 198. Private Public Customized GitHub Custom + Public Contrib 199. GUIs 200. GitX 201. GitSafe 202. GitK 203. GitGUI 204. EGit 205. ci a l ! O f fi It s 206. 4 reasons 207. Cherry Pick 208. Cherry Pick 209. Cherry Pickgit cherry-pick a5b2ee 210. Cherry Pickgit cherry-pick a5b2eeMerge in just one commit. 211. Cherry Pickgit cherry-pick a5b2eeMerge in just one commit. When you want a nugget, not a branchload. 212. Bisect Bugs 213. Bisect Bugs 214. Bisect Bugsgit bisect run mvn test 215. Bisect Bugsgitbisect run mvn testBinary-search for bug. 216. Bisect Bugsgitbisect run mvn testBinary-search for bug. Manual or automated modes. 217. Squash Verbosity 218. Squash Verbosity 219. Squash Verbosity git merge --squash mybranch 220. Squash Verbosity git merge --squash mybranchReduce all your micro-checkins to block commits. 221. Squash Verbosity git merge --squash mybranchReduce all your micro-checkins to block commits. Make mistakes, revise, checkin without hesitation. 222. Squash Verbosity git merge --squash mybranchReduce all your micro-checkins to block commits. Make mistakes, revise, checkin without hesitation. Great for SVN compatibility. 223. Search History 224. Search History 225. Search Historygit grep SomeText HEAD^^^ 226. Search Historygit grep SomeText HEAD^^^Search in le history without checkout. 227. Search Historygit grep SomeText HEAD^^^Search in le history without checkout. Greps contents. 228. emerging ControlVersion 229. Twitter@matthewmccull Matthew Bloghttp://www.ambientideas.com/blogsidebar has all my social media links [email protected] GitHubhttp://github.com/matthewmccullough 230. Resources Git Homepage http://git-scm.comDirected Acrylic Graph http://en.wikipedia.org/wiki/Directed_acyclic_graphGit for Computer Scientists http://eagain.net/articles/git-for-computer-scientists/Git Treeish http://book.git-scm.com/4_git_treeishes.html 231. Resources Git Docs http://www.kernel.org/pub/software/scm/git/docs/Git Magic eBook http://www-cs-students.stanford.edu/~blynn/gitmagic/book.pdfLinus Torvalds Git talk at Google http://www.youtube.com/watch?v=4XpnKHJAok8CygWin http://www.cygwin.com 232. Resources MSysGit http://code.google.com/p/msysgitGit Cheetah http://code.google.com/p/msysgit/wiki/GitCheetahMatthews Git Bookmarks http://delicious.com/matthew.mccullough/gitMatthews Bash Prompt http://gist.github.com/47267 233. Image Credits http://www.ambientideasphotography.com http://ickr.com/photos/lenore-m/2903856664/ http://en.wikipedia.org/wiki/Git_(software) http://ickr.com/photos/karenhorton/1583513014/ http://ickr.com/photos/mashdnart/2545782407/ http://commons.wikimedia.org/wiki/ File:Small_Boy_nuclear_test_1962.jpg http://www.ickr.com/photos/knmurphy/2506896257/ http://www.ickr.com/photos/albyspace/1022035568/ http://ickr.com/photos/michaelhays/3070238360/ http://ickr.com/photos/d_vdm/509996632/