Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dead-Simple Version Control for your Team

Dead-Simple Version Control for your Team

How we use Git and Github to build stuff at Grand Valley State University Libraries

B852b104baed98f4b7f02f5a7a75ab6b?s=128

Matthew Reidsma

July 25, 2012
Tweet

Transcript

  1. DEAD-SIMPLE VERSION CONTROL FOR YOUR TEAM GIT WITH MATTHEW REIDSMA

    GRAND VALLEY STATE UNIVERSITY
  2. WHO DOESN’T USE VERSION CONTROL?

  3. VERSION CONTROL WHO?

  4. OH BOY.

  5. WHY YOU NEED VERSION CONTROL

  6. GIT

  7. GIT

  8. WHY GIT IS AWESOME

  9. HOW GIT WORKS

  10. WORKING DIRECTORY

  11. WORKING DIRECTORY INDEX (STAGING AREA) add

  12. WORKING DIRECTORY INDEX (STAGING AREA) LOCAL REPOSITORY add commit

  13. WORKING DIRECTORY INDEX (STAGING AREA) LOCAL REPOSITORY REMOTE REPOSITORY add

    commit push
  14. My-Computer: mreidsma$ _

  15. My-Computer: mreidsma$ _ SCARY

  16. None
  17. $cd MyAwesomeApp

  18. $cd MyAwesomeApp $touch index.html

  19. $cd MyAwesomeApp $git init Initialized empty Git repository in /MyAwesomeApp/.git/

    $touch index.html
  20. $cd MyAwesomeApp $git init Initialized empty Git repository in /MyAwesomeApp/.git/

    $git add . $touch index.html
  21. $cd MyAwesomeApp $git init Initialized empty Git repository in /MyAwesomeApp/.git/

    $git add . $git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # #! new file: index.html # $touch index.html
  22. None
  23. $git commit -m “First commit” [master (root-commit) 7ce2952] First commit

    1 file changed, 2 insertions(+) create mode 100644 index.html
  24. $git commit -m “First commit” $git remote add origin git@github.com:gvsulib/

    awesomeapp.git [master (root-commit) 7ce2952] First commit 1 file changed, 2 insertions(+) create mode 100644 index.html
  25. $git commit -m “First commit” $git remote add origin git@github.com:gvsulib/

    awesomeapp.git [master (root-commit) 7ce2952] First commit 1 file changed, 2 insertions(+) create mode 100644 index.html $git push origin master
  26. None
  27. BRANCHING

  28. [master]

  29. [master]

  30. [master]

  31. [master]

  32. [master]

  33. [master] [branch]

  34. [master] [branch]

  35. [master] [branch] merge

  36. BRANCHES ARE CHEAP

  37. None
  38. $cd MyAwesomeApp

  39. $cd MyAwesomeApp $git branch newFeature

  40. $cd MyAwesomeApp $git checkout newFeature $git branch newFeature Switched to

    branch ‘newFeature’
  41. $cd MyAwesomeApp $git checkout newFeature $git branch newFeature <!-- AWESOME

    FEATURE ADDING ACTION HERE --> Switched to branch ‘newFeature’
  42. $cd MyAwesomeApp $git checkout newFeature $git add . $git branch

    newFeature <!-- AWESOME FEATURE ADDING ACTION HERE --> Switched to branch ‘newFeature’
  43. $cd MyAwesomeApp $git checkout newFeature $git add . $git status

    # On branch newFeature # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # #! modified: index.html # $git branch newFeature <!-- AWESOME FEATURE ADDING ACTION HERE --> Switched to branch ‘newFeature’
  44. None
  45. $git commit -m “Best feature ever” [newFeature 18q7d58] Best feature

    ever 1 file changed, 1 insertions(+)
  46. $git commit -m “Best feature ever” $git checkout master [newFeature

    18q7d58] Best feature ever 1 file changed, 1 insertions(+) Switched to branch ‘master’
  47. $git commit -m “Best feature ever” $git checkout master [newFeature

    18q7d58] Best feature ever 1 file changed, 1 insertions(+) $git merge newFeature Switched to branch ‘master’ Updating 7ce2952..18q7d58 index.html | 1 + 1 file changed, 1 insertion(+)
  48. BUT YOU CHANGED THE FILE

  49. WORKFLOWS

  50. LOCAL

  51. LOCAL REMOTE

  52. LOCAL LOCAL

  53. LOCAL REMOTE LOCAL

  54. LOCAL LOCAL REMOTE WEB SERVER

  55. LOCAL LOCAL REMOTE WEB SERVER

  56. HOW WE DO IT @ GVSU

  57. None
  58. None
  59. GITHUB

  60. GITHUB WEB SERVER

  61. MASTER IS ALWAYS DEPLOYABLE

  62. None
  63. $ssh username@gvsu.edu

  64. $ssh username@gvsu.edu $git mkdir MyAwesomeApp

  65. $ssh username@gvsu.edu $git cd MyAwesomeApp $git mkdir MyAwesomeApp

  66. $ssh username@gvsu.edu $git cd MyAwesomeApp remote: Counting objects: 1, done.

    remote: Compressing objects: 100% (1/1), done. remote: Total 1 (delta 21), reused 1 (delta 14) Unpacking objects: 100% (1/1), done. $git mkdir MyAwesomeApp $git clone https://github.com/gvsulib/ awesomeapp.git Cloning into awesomeapp...
  67. None
  68. $ssh username@gvsu.edu

  69. $ssh username@gvsu.edu $git cd MyAwesomeApp

  70. $ssh username@gvsu.edu $git cd MyAwesomeApp $git pull origin master

  71. BUT

  72. None
  73. None
  74. https://gist.github.com/3138516

  75. OTHER FANCY FEATURES

  76. .gitignore

  77. diff

  78. log

  79. filter-branch

  80. stash

  81. reset

  82. RESOURCES John Fink: A Gentle Introduction to Modern Version Control

    http://acrl.ala.org/techconnect/?p=1191 Flashbake - automated git for writers http:/bitbucketlabs.net/flashbake Download git http://git-scm.com Git Reference http://gitref.org Git and Github Bootcamp http://help.github.com/articles/set-up-git
  83. None
  84. THANK YOU reidsmam@gvsu.edu @mreidsma http://github.com/mreidsma http://github.com/gvsulib