i'm lovin' git

Download I'm lovin' git

Post on 13-Aug-2015

27 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  1. 1. Im lovin git @ssaunier
  2. 2. Knowledge worker We create and edit documents (text, images, etc.)
  3. 3. Everyday workow 1. Create a le 2. Save it 3. Edit it 4. Save it again 5. etc.
  4. 4. File life
  5. 5. Manual version control
  6. 6. Can we automate this? For each document version, we need to know 1. When the le was modied 2. What changed 3. Why it was modied
  7. 7. Theres more, teams
  8. 8. Theres more, teams
  9. 9. And one more question For each document version, we need to know 1. When the le was modied 2. What changed 3. Why it was modied 4. Who did the change
  10. 10. In a nutshell We want a tool which 1. tracks document version 2. keeps an history of document changes 3. foster team work
  11. 11. Set up Download & install git at http://git-scm.com/
  12. 12. Your identity $ git config --global user.name "Sebastien Saunier $ git config --global user.email "seb@lewagon.org" $ git config -l
  13. 13. Basic commands
  14. 14. Starting $ mkdir new_project $ cd new_project $ git init
  15. 15. Status $ git status git can tell you if your folder has some modied les (dirty)
  16. 16. Commit snapshot of your work
  17. 17. How to commit? # Select which file to add to the commit. $ git add $ git add # Take a snapshot of what is in the staging area. $ git commit --message "A meaningful message about this change"
  18. 18. Di If git status tells you something changed, you can inspect exactly what changed: $ git diff $ git diff
  19. 19. Log Show commit history with $ git log
  20. 20. Branching
  21. 21. One feature = One branch
  22. 22. Di $ git branch my-feature
  23. 23. Di $ git checkout my-feature $ git commit (x2)
  24. 24. Di $ git checkout master $ git commit (x2) In the meantime, one commit happened in the master branch
  25. 25. Merge $ git checkout master $ git diff master..my-feature $ git merge my-feature
  26. 26. Clean up $ git branch -d my-feature
  27. 27. Visualization http://www.wei-wang.com/ExplainGitWithD3
  28. 28. Remote
  29. 29. We need a remote! Go to GitHub, create a repo: https://github.com/new $ git remote add origin git@github.com:/.git
  30. 30. Push Share the code with your team, and the world # Generic command $ git push # What we'll use $ git push origin master
  31. 31. Pull # Generic command $ git pull # What we'll use $ git pull origin master
  32. 32. Github Desktop app https://mac.github.com/ https://windows.github.com/
  33. 33. Octodex
  34. 34. Repository page lewagon/surfcamp rails/rails Examples
  35. 35. Repository page lewagon/surfcamp rails/rails Examples
  36. 36. Prole page Example: defunkt
  37. 37. Pull requests Team workow
  38. 38. Forks Open source contribution
  39. 39. Github pages Hosting your website for free!
  40. 40. Go further ondemand.lewagon.org
  41. 41. Thank you!