Git for everyone

Git for everyone

Unless you have been living in a cave, Git is everywhere. Creative or engineering, you have directly encountered or will encounter Git in the workplace. A common misconception as well is that Git is only for teams? Regardless of work style or team size, Git is the tool that everyone should be using.

Get the Book
https://www.gitbook.io/book/anotheruiguy/gitforeveryone

992bbe0cad45fc9f941a4717f9f01642?s=128

Dale Sande

June 18, 2014
Tweet

Transcript

  1. Git the Git Workshop learn

  2.    speakerdeck.com/anotheruiguy/ git-for-everyone

  3.    gitbook.io/book/anotheruiguy/ gitforeveryone

  4. That’s me! That’s where ! I ‘work’ @ANOTHERUIGUY That’s a

    ninja
  5.   why so hard?

  6. How can I get to that file?

  7. How can I get to that file? Just open Terminal

    and then $ cd ~/Projects/ boilerplate/ && vi .gitignore
  8. How can I get to that file? Just open Terminal

    and then $ cd ~/Projects/ boilerplate/ && vi .gitignore OMG! That is weird? What do I do?
  9. How can I get to that file? Just open Terminal

    and then $ cd ~/Projects/ boilerplate/ && vi .gitignore OMG! That is weird? What do I do? Geeze, press the i key, go to this line and add <file path>/**/*. Then hit the esc key to save. To get out, type :wq, ok!?
  10. How can I get to that file? Just open Terminal

    and then $ cd ~/Projects/ boilerplate/ && vi .gitignore OMG! That is weird? What do I do? Geeze, press the i key, go to this line and add <file path>/**/*. Then hit the esc key to save. To get out, type :wq, ok!?
  11.   

  12. None
  13. Terminal Cheatsheet for Mac

  14. Open files in VI $ touch index.html

  15. Open files in VI $ touch index.html $ vi index.html

  16. Open files in VI $ touch index.html $ vi index.html

    i
  17. Open files in VI $ touch index.html $ vi index.html

    i esc + :wq
  18. Open files in VI $ touch index.html $ vi index.html

    i esc + :wq
  19.   what?

  20. Before VC or Branching my-project-folder YAY! My project!

  21. Before VC or Branching my-project-folder I need to update my

    project
  22. Before VC or Branching my-project-folder I need to update my

    project my-project-folder-copy
  23. Before VC or Branching my-project-folder my-project-folder-copy Yup, need another version

  24. Before VC or Branching my-project-folder my-project-folder-copy Yup, need another version

    my-project-folder-copy-v2
  25. Before VC or Branching my-project-folder my-project-folder-copy my-project-folder-copy-v2 Need to revert

    some code ;(
  26. Before VC or Branching my-project-folder my-project-folder-copy my-project-folder-copy-v2 Need to revert

    some code ;( Crap! Which folder has the right stuff?
  27. Before VC or Branching my-project-folder my-project-folder-copy my-project-folder-copy-v2 Need to revert

    some code ;( Crap! Which folder has the right stuff? Ok, get these lines and then …
  28. Before VC or Branching my-project-folder my-project-folder-copy my-project-folder-copy-v2 Need to revert

    some code ;( Crap! Which folder has the right stuff? Ok, get these lines and then … NOTHING IS WORKING!!
  29. Before VC or Branching my-project-folder my-project-folder-copy my-project-folder-copy-v2 Need to revert

    some code ;( Crap! Which folder has the right stuff? Ok, get these lines and then … NOTHING IS WORKING!! Boss: Hey, we have a new person you will work with. You need to share code and work on solving problems together. ! ! You: SHIT! Dropbox, why you no scale?
  30. Inexpensive versioning master

  31. Inexpensive versioning master

  32. Inexpensive versioning master feature-branch

  33. Inexpensive versioning master feature-branch

  34. Inexpensive versioning master feature-branch feature-branch

  35. Inexpensive versioning master feature-branch feature-branch

  36. Inexpensive versioning master feature-branch feature-branch

  37. Inexpensive versioning master feature-branch feature-branch

  38. Forking and Cloning

  39. Forking and Cloning $ git clone git@github.com:blackfalcon/label-reveal.git

  40. Forking and Cloning Source

  41. Forking and Cloning Source Your fork

  42. Forking and Cloning Source Your fork feature-branch feature-branch

  43. Forking and Cloning Source Your fork feature-branch feature-branch

  44. Forking and Cloning Source Your fork feature-branch feature-branch The Pull

    Request
  45.    branching and merging

  46. $ git branch

  47. $ git branch $ git checkout master

  48. $ git branch $ git checkout master $ git pull

    origin master
  49. $ git branch $ git checkout master $ git pull

    origin master $ git checkout -b my-new-feature-branch
  50. $ git branch $ git checkout master $ git pull

    origin master $ git checkout -b my-new-feature-branch $ git checkout -b transaction-fail-message master
  51. $ git status

  52. $ git status $ git add .

  53. $ git status $ git add . $ git add

    -u
  54. $ git status $ git add . $ git add

    -u $ git add --all
  55. $ git status $ git add . $ git add

    -u $ git add --all $ git commit -m "a commit message in the present tense"
  56. $ git commit -m "fixed bug with login feature" 

     
  57. $ git commit -m "fixed bug with login feature" 

     
  58. $ git commit -m "fixed bug with login feature" 

      $ git commit -m "update app config to address login bug"
  59. $ git branch -r << this will list remote branches

      
  60. $ git branch -r << this will list remote branches

    $ git fetch -p << this will prune your local index   
  61. $ git branch -r << this will list remote branches

    $ git fetch -p << this will prune your local index    $ git checkout new-remote-feature-branch
  62. None
  63. $ git checkout my-feature-branch   

  64. $ git checkout my-feature-branch $ git pull origin my-feature-branch 

     
  65. $ git checkout my-feature-branch $ git pull origin my-feature-branch 

      $ git pull origin master
  66. $ git checkout master   

  67. $ git checkout master $ git pull origin master 

     
  68. $ git checkout master $ git pull origin master 

      $ git merge --no-ff my-feature-branch
  69. None
  70. None
  71. $ cd ~/Desktop

  72. $ cd ~/Desktop $ mkdir gitDemo

  73. $ cd ~/Desktop $ mkdir gitDemo $ cd gitDemo &&

    git status
  74. $ cd ~/Desktop $ mkdir gitDemo $ cd gitDemo &&

    git status $ git init
  75. $ cd ~/Desktop $ mkdir gitDemo $ cd gitDemo &&

    git status $ git init $ git status
  76. $ touch index.html

  77. $ touch index.html $ mkdir stylesheets

  78. $ touch index.html $ mkdir stylesheets $ mkdir javascripts

  79. $ touch index.html $ mkdir stylesheets $ mkdir javascripts $

    cd stylesheets && touch app.css && cd ../
  80. $ touch index.html $ mkdir stylesheets $ mkdir javascripts $

    cd stylesheets && touch app.css && cd ../ $ cd javascripts && touch app.js && cd ../
  81. $ mkdir foo    

  82. $ mkdir foo $ git status    

  83. $ mkdir foo $ git status $ rm -rf foo

       
  84. <h1>Hello World</h1> 

  85. <h1>Hello World</h1> h1 { font-size: 8em; } 

  86. <h1>Hello World</h1> h1 { font-size: 8em; } var today =

    new Date() 
  87. $ git add .

  88. $ git add . $ git status

  89. $ git add . $ git status $ git commit

    -m "update to function ..."
  90. $ git add . $ git status $ git commit

    -m "update to function ..." $ git status
  91. $ git add . $ git status $ git commit

    -m "update to function ..." $ git status # On branch master nothing to commit …
  92. $ git log   

  93. $ git log $ git blame index.html   

  94. $ git log $ git blame index.html ^15d42d5 (Dale Sande

    2014-06-10 18:25:26 -0700 1)   
  95. $ git branch

  96. $ git branch $ git checkout -b new-branch

  97. $ git branch $ git checkout -b new-branch <p>goodnight moon</p>

  98. $ git branch $ git checkout -b new-branch <p>goodnight moon</p>

    p { font-size: 2em; }
  99. $ git branch $ git checkout -b new-branch <p>goodnight moon</p>

    p { font-size: 2em; } $ git status
  100. $ git add .    

  101. $ git add . $ git commit -m "update content

    and styles"    
  102. $ git add . $ git commit -m "update content

    and styles" $ git checkout master    
  103. $ git checkout master   

  104. $ git checkout master $ git branch --merged  

    
  105. $ git checkout master $ git branch --merged $ git

    branch --no-merged   
  106. $ git merge new-branch --no-ff   

  107. $ git merge new-branch --no-ff :wq   

  108. $ git merge new-branch --no-ff :wq $ git branch --merged

      
  109. None
  110. None
  111. None
  112.  fork all the codes

  113. None
  114.   clone all the codes

  115. None
  116.    you Git awesome!

  117. $ which git     If a version

    of Git is not there! …
  118. None
  119. $ brew install git    this is pretty

    metal
  120. $ brew install git    this is pretty

    metal PATH=/usr/local/bin:$PATH That goes in your ~/.bash_profile bro!
  121. None
  122. $ cd ~/Desktop

  123. $ cd ~/Desktop $ mkdir gitDemo

  124. $ cd ~/Desktop $ mkdir gitDemo $ cd gitDemo &&

    git status
  125. $ cd ~/Desktop $ mkdir gitDemo $ cd gitDemo &&

    git status $ git init
  126. $ cd ~/Desktop $ mkdir gitDemo $ cd gitDemo &&

    git status $ git init $ git status
  127. $ touch index.html

  128. $ touch index.html $ mkdir stylesheets

  129. $ touch index.html $ mkdir stylesheets $ mkdir javascripts

  130. $ touch index.html $ mkdir stylesheets $ mkdir javascripts $

    cd stylesheets && touch app.css && cd ../
  131. $ touch index.html $ mkdir stylesheets $ mkdir javascripts $

    cd stylesheets && touch app.css && cd ../ $ cd javascripts && touch app.js && cd ../
  132. $ mkdir foo    

  133. $ mkdir foo $ git status    

  134. $ mkdir foo $ git status $ rm -rf foo

       
  135.  <h1>Hello World</h1> That goes in your index.html

  136.  <h1>Hello World</h1> That goes in your index.html h1 {

    font-size: 8em; } That goes in your app.css
  137.  <h1>Hello World</h1> That goes in your index.html h1 {

    font-size: 8em; } That goes in your app.css var today = new Date() That goes in your app.js
  138. $ git add .

  139. $ git add . $ git status

  140. $ git add . $ git status $ git commit

    -m "update to function ..."
  141. $ git add . $ git status $ git commit

    -m "update to function ..." $ git status
  142. $ git add . $ git status $ git commit

    -m "update to function ..." $ git status # On branch master nothing to commit …
  143. $ git log   

  144. $ git log $ git blame index.html   

  145. $ git log $ git blame index.html ^15d42d5 (Dale Sande

    2014-06-10 18:25:26 -0700 1)   
  146. $ git branch

  147. $ git branch $ git checkout -b new-branch

  148. $ git branch $ git checkout -b new-branch <p>goodnight moon</p>

  149. $ git branch $ git checkout -b new-branch <p>goodnight moon</p>

    p { font-size: 2em; }
  150. $ git branch $ git checkout -b new-branch <p>goodnight moon</p>

    p { font-size: 2em; } $ git status
  151. $ git add .    

  152. $ git add . $ git commit -m "update content

    and styles"    
  153. $ git add . $ git commit -m "update content

    and styles" $ git checkout master    
  154. $ git checkout master   

  155. $ git checkout master $ git branch --merged  

    
  156. $ git checkout master $ git branch --merged $ git

    branch --no-merged   
  157. $ git merge new-branch --no-ff   

  158. $ git merge new-branch --no-ff :wq   

  159. $ git merge new-branch --no-ff :wq $ git branch --merged

      
  160. $ git log --abbrev-commit --graph"   

  161. None
  162. None
  163. None
  164.    come Git more!

  165. Thanks!