Git in 5 Minutes

7be7f45c8b9c235e2c3741a9a55e7ade?s=47 Rob Dumas
February 13, 2013

Git in 5 Minutes

A shorter version of my earlier talk, this time presented at Code4Lib 2013. You can also view the video of me giving the talk on Archive.org. http://archive.org/details/Code4libRobDumas

7be7f45c8b9c235e2c3741a9a55e7ade?s=128

Rob Dumas

February 13, 2013
Tweet

Transcript

  1. in 5 minutes r2d.to/gitstart

  2. snapshots

  3. snapshots

  4. git-scm.com

  5. ✓ what files have changed ✓ who made those changes

    ✓ when the changes were made ✓ how those changed files differ ✓ why they were changed (hopefully) version control
  6. wikipedia record of changes to articles over time

  7. ✓free & open source ✓local & distributed ✓fast & secure

    ✓stable & popular what’s so great about git?
  8. getting git installing it baked right in textmate bundle xcode

    and more! eclipse plugin use homebrew mxcl.github.com/homebrew use apt-get or yum download it git-scm.com/downloads
  9. basic workflow create/ clone repository make changes commit changes stage

    changes 1 2 3 4
  10. photo credit: muy yum (flic.kr/p/7ByV6Y) stage work area git

  11. git basics

  12. creating a repository $  cd  myproject $  git  init

  13. myproject/.git/ don’t touch these files!

  14. cloning a repository $  git  clone  https://github.com/ progit/progit.git folder or

    URL the location can be a folder or url
  15. staging changes $  git  add  myfile.html $  git  add  css/*

    you have to stage your changes each time you commit!
  16. committing changes $  git  commit  -­‐m  "Added   new  file,

     myfile.html,   to  repo."
  17. other commands $  git  log $  git  diff  a65fe40 $

     git  rm $  git  mv commit hash
  18. .gitignore source/* *.temp nuclear-­‐launch-­‐codes.txt put files, folders and patterns in

    this file to tell git to ignore them.
  19. branching & merging master development feature

  20. branching $  git  branch  child $  git  checkout  child 1.

    create child branch 2. check out child branch 3. work on new branch
  21. merging $  git  checkout  parent $  git  merge  child 1.

    check out parent branch 2. merge child branch into parent
  22. tagging $  git  tag  -­‐a  v1.0  -­‐m  "Product  release" $

     git  tag  -­‐a  ronburgundy  -­‐m  "Brick      killed  a  guy  with  a  trident." master development v1.0
  23. distributed git shared repository developer developer developer $  git  pull

     origin  master $  git  push  origin  master
  24. further reading

  25. get started with git alistapart.com/articles/get-started-with-git

  26. Version Control with Git 2nd. Edition by Loeliger & McCullough

    © 2012 O’Reilly Media ISBN 978-1-4493-1638-9 r2d.to/oreillygitbook
  27. ✓git-scm.com/book ✓git-scm.com/videos ✓gitready.com ✓gitref.org ✓gitcasts.com ✓gitimmersion.com ✓try.github.com ✓help.github.com ✓codeschool.com/ courses/git-real

    useful links
  28. rob dumas chicago public library @stray thank you, code4lib! r2d.to/gitstart