Git and GitHub

11,171 views

Published on

This is a lengthy talk I gave to OK.rb in April covering many aspects of Git and GitHub.

Published in: Technology

Git and GitHub

  1. 1. Git and GitHub The unabridged story
  2. 2. BUT FIRST A WORD FROM OUR SPONSOR
  3. 3. BUT FIRST A WORD FROM OUR SPONSOR
  4. 4. BUT FIRST A WORD FROM OUR SPONSOR HAPPY BIRTHDAY DANA!
  5. 5. Git The stupid content tracker
  6. 6. What is Git, really?
  7. 7. Intelligence Check
  8. 8. Intelligence Check Subversion is a smart database of file differences
  9. 9. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex
  10. 10. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid
  11. 11. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid Stores trees of content, much like a file system
  12. 12. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid Stores trees of content, much like a file system A commit creates a new tree reachable by name
  13. 13. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid Stores trees of content, much like a file system A commit creates a new tree reachable by name It can change your directory to recreate any tree
  14. 14. Git Isn’t Really an SCM
  15. 15. Git Isn’t Really an SCM Git does Source Code Management and
  16. 16. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution
  17. 17. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database
  18. 18. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database Distributed wiki
  19. 19. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database Distributed wiki Distributed issue tracker
  20. 20. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database Distributed wiki Distributed issue tracker Backups
  21. 21. The Plusses of a Simple Design
  22. 22. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base)
  23. 23. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base) Git is very efficient
  24. 24. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base) Git is very efficient Git handles non-linear development with grace
  25. 25. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base) Git is very efficient Git handles non-linear development with grace Git is distributed from the ground up
  26. 26. SOMETIMES YOU HAVE A TOILET IN YOUR YARD
  27. 27. SOMETIMES YOU HAVE A TOILET IN YOUR YARD AND WHO WANTS THAT, REALLY?
  28. 28. The Minuses of the Toolkit Design
  29. 29. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it
  30. 30. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it The “porcelain” commands are the ones you typically interact with
  31. 31. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it The “porcelain” commands are the ones you typically interact with The lower-level “plumbing” commands are crazy powerful, but less user friendly
  32. 32. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it The “porcelain” commands are the ones you typically interact with The lower-level “plumbing” commands are crazy powerful, but less user friendly This can add up to make Git a little intimidating
  33. 33. Installing and Configuring
  34. 34. IF YOU BUILD IT, THEY WILL COME
  35. 35. IF YOU BUILD IT, THEY WILL COME
  36. 36. IF YOU BUILD IT, THEY WILL COME SOMETIMES YOU JUST HAVE TO INSTALL A RIDICULOUS ROBOT
  37. 37. OFFICIAL SITE: HTTP://GIT-SCM.COM/ THERE ARE BINARIES FOR SOME PLATFORMS
  38. 38. OFFICIAL SITE: HTTP://GIT-SCM.COM/ THERE ARE BINARIES FOR SOME PLATFORMS
  39. 39. OFFICIAL SITE: HTTP://GIT-SCM.COM/ THERE ARE BINARIES FOR SOME PLATFORMS
  40. 40. THE INSTRUCTIONS I USE TO BUILD ON MAC OS X THESE SIDESTEP THE DOCUMENTATION AND MACPORTS REQUIREMENTS
  41. 41. THE INSTRUCTIONS I USE TO BUILD ON MAC OS X THESE SIDESTEP THE DOCUMENTATION AND MACPORTS REQUIREMENTS
  42. 42. Git is still young and growing fast (update to 1.7)
  43. 43. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
  44. 44. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
  45. 45. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
  46. 46. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
  47. 47. set mainfont {Monaco 12} set textfont {Monaco 12} set uifont {"Monaco Bold" 12} set tabstop 8 set findmergefiles 0 set maxgraphpct 50 set maxwidth 16 set cmitmode patch set wrapcomment none set showneartags 1 set showlocalchanges 1 set datetimeformat {%Y-%m-%d %H:%M:%S} set limitdiffs 1 set bgcolor white set fgcolor black set colors {green red blue magenta darkgrey brown orange} set diffcolors {red "#00a000" blue} set diffcontext 3 set selectbgcolor gray85 set geometry(main) 794x484+5+45 set geometry(topwidth) 790 set geometry(topheight) 150 set geometry(pwsash0) "280 2" set geometry(pwsash1) "420 2" set geometry(botwidth) 350 set geometry(botheight) 314 set permviews {} ~/.GITK THESE SETTINGS CLEAN UP THE INCLUDED GUI
  48. 48. # Git alias g="git status" alias ga="git add" alias gaa="git add ." alias gc="git commit -m" alias gca="git commit -am" alias gb="git branch" alias gbd="git branch -d" alias gco="git checkout" alias gcob="git checkout -b" alias gm="git merge" alias gr="git rebase" alias gl="git log" alias gs="git show" alias gd="git diff" alias gbl="git blame" alias gps="git push" alias gpl="git pull" ~/.BASHRC THESE ARE SOME BASH ALIASES I USE
  49. 49. # Git alias g="git status" alias ga="git add" alias gaa="git add ." alias gc="git commit -m" alias gca="git commit -am" alias gb="git branch" alias gbd="git branch -d" alias gco="git checkout" alias gcob="git checkout -b" alias gm="git merge" alias gr="git rebase" alias gl="git log" alias gs="git show" alias gd="git diff" alias gbl="git blame" alias gps="git push" alias gpl="git pull" ~/.BASHRC THESE ARE SOME BASH ALIASES I USE
  50. 50. # Git alias g="git status" alias ga="git add" alias gaa="git add ." alias gc="git commit -m" alias gca="git commit -am" alias gb="git branch" alias gbd="git branch -d" alias gco="git checkout" alias gcob="git checkout -b" alias gm="git merge" alias gr="git rebase" alias gl="git log" alias gs="git show" alias gd="git diff" alias gbl="git blame" alias gps="git push" alias gpl="git pull" ~/.BASHRC THESE ARE SOME BASH ALIASES I USE
  51. 51. Memorize all of That?
  52. 52. Memorize all of That? There’s a new trend to store your “dotfiles” online
  53. 53. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them
  54. 54. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them Plus we can all share
  55. 55. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them Plus we can all share Surprise: A great place to find these is GitHub
  56. 56. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them Plus we can all share Surprise: A great place to find these is GitHub Mine are at: http://github.com/JEG2/dotfiles
  57. 57. Staging and Commits
  58. 58. DANA IS SAD
  59. 59. DANA IS SAD
  60. 60. DANA IS SAD HER CRAFT ROOM IS TRANSITIONING INTO A NURSERY
  61. 61. STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
  62. 62. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
  63. 63. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
  64. 64. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
  65. 65. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
  66. 66. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
  67. 67. GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
  68. 68. THE WORKING DIRECTORY GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
  69. 69. THE INDEX OR STAGING AREA GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
  70. 70. THE REPOSITORY GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
  71. 71. GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
  72. 72. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
  73. 73. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
  74. 74. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
  75. 75. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
  76. 76. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
  77. 77. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
  78. 78. Branching and Merging
  79. 79. YOU CAN ADD BRANCHES TO ANYTHING
  80. 80. YOU CAN ADD BRANCHES TO ANYTHING
  81. 81. YOU CAN ADD BRANCHES TO ANYTHING A KID, YOUR SOURCE CODE, OR WHATEVER
  82. 82. Using Git without branches is like buying condoms and not having any sex
  83. 83. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
  84. 84. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
  85. 85. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
  86. 86. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
  87. 87. THE INCLUDED GITK SHOWS BRANCHES PASS THE --ALL FLAG TO SEE BRANCHES YOU AREN’T CURRENTLY ON
  88. 88. THE INCLUDED GITK SHOWS BRANCHES PASS THE --ALL FLAG TO SEE BRANCHES YOU AREN’T CURRENTLY ON
  89. 89. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
  90. 90. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
  91. 91. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
  92. 92. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
  93. 93. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
  94. 94. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
  95. 95. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
  96. 96. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
  97. 97. REBASE CAN BE USED TO FLATTEN THE HISTORY YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
  98. 98. REBASE CAN BE USED TO FLATTEN THE HISTORY YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
  99. 99. REBASE CAN BE USED TO FLATTEN THE HISTORY YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
  100. 100. NOW THE MERGED HISTORY IS JUST A FLAT LINE GIT REPLAYED OUR CHANGES ONTO THE END OF THE MASTER BRANCH
  101. 101. With Git, it’s never too late to branch!
  102. 102. YOU CAN STILL BRANCH AFTER CHANGES IF A PROBLEM STARTS TO LOOK BIG AFTER WORKING ON IT, MOVE IT INTO A BRANCH
  103. 103. YOU CAN STILL BRANCH AFTER CHANGES IF A PROBLEM STARTS TO LOOK BIG AFTER WORKING ON IT, MOVE IT INTO A BRANCH
  104. 104. GIT STASH CAN HOLDS SOME CHANGES FOR LATER I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
  105. 105. GIT STASH CAN HOLDS SOME CHANGES FOR LATER I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
  106. 106. GIT STASH CAN HOLDS SOME CHANGES FOR LATER I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
  107. 107. Editing History
  108. 108. DANA REVISED HER OWN HISTORY
  109. 109. DANA REVISED HER OWN HISTORY
  110. 110. DANA REVISED HER OWN HISTORY
  111. 111. DANA REVISED HER OWN HISTORY SHE THREW OUT ABOUT 60 COMMITS… ERR, POUNDS
  112. 112. Git Trusts you With the Scary Power Tools
  113. 113. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history
  114. 114. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history Total rewrites are possible
  115. 115. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history Total rewrites are possible Some consider this very evil
  116. 116. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history Total rewrites are possible Some consider this very evil Let me show you two lighter uses that I consider practical
  117. 117. YOU CAN AMEND (OR ADD TO) A COMMIT THIS IS AWESOME PERFECT FOR WHEN YOU FORGET TO ADD A FILE
  118. 118. YOU CAN AMEND (OR ADD TO) A COMMIT THIS IS AWESOME PERFECT FOR WHEN YOU FORGET TO ADD A FILE
  119. 119. YOU GET A CHANCE TO REVISE THE MESSAGE AS YOU CAN SEE, I HAVE TEXTMATE SET AS MY EDITOR
  120. 120. THE TWO COMMITS BECAME ONE NOTICE HOW ALL ASPECTS OF THE SECOND COMMIT WERE ROLLED INTO THE FIRST
  121. 121. THE TWO COMMITS BECAME ONE NOTICE HOW ALL ASPECTS OF THE SECOND COMMIT WERE ROLLED INTO THE FIRST
  122. 122. GIT CAN “CHERRY PICK” COMMITS YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
  123. 123. GIT CAN “CHERRY PICK” COMMITS YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
  124. 124. GIT CAN “CHERRY PICK” COMMITS YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
  125. 125. Git Speaks Subversion
  126. 126. WHEELCHAIRS CAN RIDE JAPAN’S TRAINS
  127. 127. WHEELCHAIRS CAN RIDE JAPAN’S TRAINS
  128. 128. WHEELCHAIRS CAN RIDE JAPAN’S TRAINS BE SURE YOU SPEAK A LITTLE JAPANESE THOUGH, JUST IN CASE!
  129. 129. Git Ships With Subversion Support
  130. 130. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL
  131. 131. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed
  132. 132. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase
  133. 133. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase Subversion requires a linear history, thus rebase
  134. 134. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase Subversion requires a linear history, thus rebase Use Git to develop locally as normal
  135. 135. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase Subversion requires a linear history, thus rebase Use Git to develop locally as normal Commit all diffs to Subversion: git svn dcommit
  136. 136. Distributed Repositories
  137. 137. YOU CAN NEVER HAVE TOO FEW GEEKS
  138. 138. YOU CAN NEVER HAVE TOO FEW GEEKS
  139. 139. YOU CAN NEVER HAVE TOO FEW GEEKS I NEED THIS MANY JUST TO PLAY A GAME ONCE A YEAR
  140. 140. git clone git://192.168.0.109/faster_csv
  141. 141. To Set That Up…
  142. 142. To Set That Up… I created a git_server directory on my Desktop
  143. 143. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it
  144. 144. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it I ran: git daemon --base-path=/Users/james/ Desktop/git_server --export-all
  145. 145. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it I ran: git daemon --base-path=/Users/james/ Desktop/git_server --export-all This is read-only (but write support is possible) access on port 9418
  146. 146. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it I ran: git daemon --base-path=/Users/james/ Desktop/git_server --export-all This is read-only (but write support is possible) access on port 9418 This rocks for when GitHub is down
  147. 147. http://192.168.0.109:1234/
  148. 148. An Instant Web Interface
  149. 149. An Instant Web Interface I moved into the Git working directory
  150. 150. An Instant Web Interface I moved into the Git working directory I ran: git instaweb --httpd=webrick
  151. 151. An Instant Web Interface I moved into the Git working directory I ran: git instaweb --httpd=webrick Later, I will stop it with: git instaweb --stop
  152. 152. An Instant Web Interface I moved into the Git working directory I ran: git instaweb --httpd=webrick Later, I will stop it with: git instaweb --stop This is a handy poor man’s repository browser that’s pretty much always available
  153. 153. Git Strategies
  154. 154. EVERYBODY HAS THEIR SYSTEM
  155. 155. EVERYBODY HAS THEIR SYSTEM
  156. 156. EVERYBODY HAS THEIR SYSTEM
  157. 157. EVERYBODY HAS THEIR SYSTEM
  158. 158. EVERYBODY HAS THEIR SYSTEM
  159. 159. EVERYBODY HAS THEIR SYSTEM DANA HAS ONE JUST FOR FOOD
  160. 160. Git Supports Many Work Styles
  161. 161. Git Supports Many Work Styles Git’s features make it very flexible
  162. 162. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported
  163. 163. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided
  164. 164. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided All repositories are masters
  165. 165. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided All repositories are masters Any repository can be distributed
  166. 166. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided All repositories are masters Any repository can be distributed Many work strategies are built off of these features
  167. 167. Branch Strategies
  168. 168. SAY WE HAVE A BRANCH WITH TWO COMMITS THIS IS A PRETTY TYPICAL GIT SCENARIO, A TOPIC BRANCH OFF OF MASTER
  169. 169. FAST FORWARD (A FLAT MERGE) BY DEFAULT, GIT WOULD JUST ADD THESE COMMITS ONTO MASTER
  170. 170. YOU CAN FORCE GIT TO KEEP THE BRANCH HTTP://NVIE.COM/GIT-MODEL
  171. 171. YOU CAN FORCE GIT TO KEEP THE BRANCH HTTP://NVIE.COM/GIT-MODEL
  172. 172. NOTICE HOW GIT ADDED A MERGE COMMIT YOU CAN REVERT THAT ONE COMMIT TO UNDO THE ENTIRE BRANCH
  173. 173. NOTICE HOW GIT ADDED A MERGE COMMIT YOU CAN REVERT THAT ONE COMMIT TO UNDO THE ENTIRE BRANCH
  174. 174. ALTERNATELY, YOU COULD SQUASH THE COMMITS HTTP://GEEWAX.ORG/2009/11/21/AGILE-GIT-WORKFLOW.HTML
  175. 175. ALTERNATELY, YOU COULD SQUASH THE COMMITS HTTP://GEEWAX.ORG/2009/11/21/AGILE-GIT-WORKFLOW.HTML
  176. 176. REBASE ASKS ME HOW TO HANDLE EACH COMMIT GIT COMMANDS LIKE ADD AND REBASE SUPPORT A POWERFUL INTERACTIVE MODE
  177. 177. REBASE ASKS ME HOW TO HANDLE EACH COMMIT GIT COMMANDS LIKE ADD AND REBASE SUPPORT A POWERFUL INTERACTIVE MODE
  178. 178. YOU EVEN GET TO REVISE THE COMMITS COMBINE OR REPLACE THEM TO TASTE
  179. 179. YOU EVEN GET TO REVISE THE COMMITS COMBINE OR REPLACE THEM TO TASTE
  180. 180. FINALLY, MERGE THE COLLAPSED COMMIT I CAN USE THE POWER OF INTERACTIVE MODE TO COLLAPSE THINGS INTO ONE COMMIT
  181. 181. FINALLY, MERGE THE COLLAPSED COMMIT I CAN USE THE POWER OF INTERACTIVE MODE TO COLLAPSE THINGS INTO ONE COMMIT
  182. 182. A TOPIC BRANCH WAS REDUCED TO ONE COMMIT THIS IS ANOTHER TECHNIQUE THAT ALLOWS US TO UNDO IT WITH ONE REVERT
  183. 183. A TOPIC BRANCH WAS REDUCED TO ONE COMMIT THIS IS ANOTHER TECHNIQUE THAT ALLOWS US TO UNDO IT WITH ONE REVERT
  184. 184. Master Repository Strategies
  185. 185. YOUR SUBVERSION STRATEGY STILL WORKS FINE THIS IS HOW GITHUB IS COMMONLY USED
  186. 186. LINUS USES HIS “CIRCLE OF TRUST” HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
  187. 187. LINUS USES HIS “CIRCLE OF TRUST” HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
  188. 188. LINUS USES HIS “CIRCLE OF TRUST” HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
  189. 189. GitHub https://github.com/ Social coding with Git
  190. 190. GitHub is one of Git’s Killer Features
  191. 191. THIS IS CALLED “FORKING”
  192. 192. THIS IS CALLED “FORKING” DANA IS SPINNING OFF OF A COPY OF GENES WE WILL EDIT SEPARATELY
  193. 193. “Hardcore Forking Action”
  194. 194. CREATING A GITHUB REPOSITORY IS TRIVIAL PUBLIC, OPEN SOURCE REPOSITORIES ARE FREE!
  195. 195. CREATING A GITHUB REPOSITORY IS TRIVIAL PUBLIC, OPEN SOURCE REPOSITORIES ARE FREE!
  196. 196. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
  197. 197. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
  198. 198. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
  199. 199. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
  200. 200. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
  201. 201. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
  202. 202. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
  203. 203. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
  204. 204. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
  205. 205. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
  206. 206. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
  207. 207. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
  208. 208. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
  209. 209. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
  210. 210. THE FORK QUEUE CAN MERGE EXTERNAL CHANGES I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
  211. 211. THE FORK QUEUE CAN MERGE EXTERNAL CHANGES I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
  212. 212. THE FORK QUEUE CAN MERGE EXTERNAL CHANGES I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
  213. 213. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
  214. 214. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
  215. 215. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
  216. 216. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
  217. 217. FETCHING A REMOTE GIT FETCH ALLOWS YOU TO ADD ALL DETAILS OF A REMOTE TO YOUR LOCAL COPY
  218. 218. FETCHING A REMOTE GIT FETCH ALLOWS YOU TO ADD ALL DETAILS OF A REMOTE TO YOUR LOCAL COPY
  219. 219. PLAY WITH CODE FROM A REMOTE LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
  220. 220. PLAY WITH CODE FROM A REMOTE LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
  221. 221. PLAY WITH CODE FROM A REMOTE LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
  222. 222. FULLY SHARE WITH COLLABORATORS A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
  223. 223. FULLY SHARE WITH COLLABORATORS A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
  224. 224. FULLY SHARE WITH COLLABORATORS A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
  225. 225. Gists
  226. 226. OUR NEIGHBOR’S YARD
  227. 227. OUR NEIGHBOR’S YARD SOME THINGS ARE TOO GOOD NOT TO SHARE
  228. 228. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
  229. 229. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
  230. 230. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
  231. 231. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
  232. 232. IT’S A PASTE AND A GIT REPOSITORY YOU CAN FORK THIS CODE OR CLONE IT TO WORK WITH LOCALLY
  233. 233. IT’S A PASTE AND A GIT REPOSITORY YOU CAN FORK THIS CODE OR CLONE IT TO WORK WITH LOCALLY
  234. 234. Hooks
  235. 235. IT’S ALWAYS GOOD TO HAVE TRAINED HELP
  236. 236. IT’S ALWAYS GOOD TO HAVE TRAINED HELP
  237. 237. IT’S ALWAYS GOOD TO HAVE TRAINED HELP YOU CAN TEACH GIT AND GITHUB NEW TRICKS
  238. 238. GIT HOOKS THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
  239. 239. GIT HOOKS THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
  240. 240. GIT HOOKS THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
  241. 241. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
  242. 242. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
  243. 243. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
  244. 244. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
  245. 245. README Formatting
  246. 246. FIRST IMPRESSIONS MATTER
  247. 247. FIRST IMPRESSIONS MATTER
  248. 248. FIRST IMPRESSIONS MATTER
  249. 249. FIRST IMPRESSIONS MATTER YOU HAVE TO ADVERTISE WHAT’S INSIDE
  250. 250. GITHUB IS SMART ABOUT README FORMATS IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
  251. 251. GITHUB IS SMART ABOUT README FORMATS IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
  252. 252. GITHUB IS SMART ABOUT README FORMATS IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
  253. 253. Supported Formats
  254. 254. Supported Formats RDoc (.rdoc)
  255. 255. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation
  256. 256. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation Markdown (.markdown, .md, .mdown, …)
  257. 257. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation Markdown (.markdown, .md, .mdown, …) A human-readable format for other projects
  258. 258. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation Markdown (.markdown, .md, .mdown, …) A human-readable format for other projects Also supported: Textile (.textile), PNG (.png), reStructuredText (.rst), and POD (.pod)
  259. 259. GitHub Pages
  260. 260. OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/
  261. 261. OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/
  262. 262. OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/ YOU CAN HELP MAKE THIS BETTER
  263. 263. IT’S A PROJECT ON GITHUB THE GITHUB PAGES FEATURE TURNS THIS INTO A REAL SITE
  264. 264. IT’S A PROJECT ON GITHUB THE GITHUB PAGES FEATURE TURNS THIS INTO A REAL SITE
  265. 265. GitHub Pages
  266. 266. GitHub Pages Name a repository after you: USER.github.com
  267. 267. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository
  268. 268. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit
  269. 269. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit Sites are Jekyll (a static site generator) processed
  270. 270. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit Sites are Jekyll (a static site generator) processed Used to build listings, syntax highlight, etc.
  271. 271. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit Sites are Jekyll (a static site generator) processed Used to build listings, syntax highlight, etc. You can point a real domain at them
  272. 272. Documentation Learning more about Git and GitHub
  273. 273. IF YOU FELL ASLEEP IN THIS TALK…
  274. 274. IF YOU FELL ASLEEP IN THIS TALK… YOU MAY NEED TO RTFM
  275. 275. Where to Find the Docs
  276. 276. Where to Find the Docs Git has awesome man(ual) pages
  277. 277. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash
  278. 278. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book
  279. 279. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book Free online: http://progit.org/
  280. 280. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book Free online: http://progit.org/ GitHub has good guides: http://help.github.com/
  281. 281. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book Free online: http://progit.org/ GitHub has good guides: http://help.github.com/ They cover GitHub and Git topics
  282. 282. You have passed this endurance test!

×