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

git (Agile Day)

git (Agile Day)

Introduction to Git. A presentation I gave at Agile Day.


Mindaugas Mozūras

May 22, 2012


  1. git or: how I learned to stop worrying and love

    source control
  2. None
  3. why you should care

  4. Traditional version control systems have deficiencies

  5. Subversion, Perforce, CVS, TFS...


  7. using svn

  8. using git

  9. is awesome git

  10. It’s distributed! Distributed Version Control System

  11. Every repository is equal.

  12. You can work offline.

  13. Fast as lightning.

  14. add status diff log commit branch git mercurial bazaar

  15. Very efficient. git clone rails - 53 seconds 40mb, 2356

    files, 29045 commits
  16. Great branching and merging.

  17. Any workflow you want, you got it...

  18. Shared repository

  19. Blessed repository Linus Torvalds Lieutenants Developers

  20. how toinstall

  21. Linux: apt-get install git-core Mac OS X: brew install git

    Windows: chocolatey install msysgit
  22. Download from git-scm.com

  23. getting started

  24. git config --global user.name ... git config --global user.email ...

  25. git init

  26. master has no special meaning. It’s just a default branch.

  27. git add

  28. Staging area stores info about what will go into next

  29. working directory staging area repository commit checkout the project stage

  30. git commit

  31. 189f30b664981e4397625791c8ea3bbb5f2279a3 Commit “name” is a 40-digit SHA

  32. commit 189f30b... tree e8455... parent(s) nil author Mindaugas... committer Mindaugas...

    Initial commit
  33. tree e8455... blob bc52a... README.md

  34. blob bc52a...

  35. SVN, CVS, Perforce store differences between commits.

  36. Git stores snapshots.

  37. commit0 commit1 commit2 tree0 tree1 tree2 blob A blob B

    blob A blob A2 blob B2 blob B2
  38. Basic training complete.

  39. and pushing pulling

  40. git remote add origin git@git...

  41. git push origin master

  42. git pull origin master

  43. and merging branching

  44. git branch name

  45. Branch is a reference to the head of a line

    of work.
  46. C0 C1 master feature

  47. git checkout name

  48. git merge name

  49. C0 master C1 C2 F1 F2 feature

  50. C0 master C1 C2 F1 F2 feature C3

  51. git rebase name

  52. C0 master C1 C2 F1 F2 feature

  53. C0 master F2 C2 C1 F1 feature

  54. merge is fine, but in a lot of cases, rebase

    is better.
  55. Branching - too easy not to do

  56. manipulating history

  57. git commit --amend

  58. git rebase --interactive

  59. Interactive rebase lets you: reword, edit, squash, fixup, exec, remove

    and reorder.
  60. You can change history of remote repository with git push

    --force. Be careful!
  61. Rewriting history is fun and useful!

  62. svn git-

  63. git svn clone http://...

  64. git svn rebase ~ svn update

  65. git svn dcommit ~ svn commit

  66. GitHub

  67. The best way to collaborate.

  68. More than 1.6 million people, 2.8 million repositories.

  69. Used by individuals.

  70. None
  71. And organizations.

  72. None
  73. thoughts closing

  74. blame bisect cherry-pick clean cvsimport describe diff fetch filter-branch grep

    request-pull revert svnimport stash submodule tag and more...
  75. git-scm.com gitready.com gitimmersion.com ontwik.com/category/git-github RESOURCES

  76. Git != Subversion + Magic

  77. The slogan of Subversion for a while was "CVS done

    right". If you start with that kind of slogan, there's nowhere you can go. There is no way to do CVS right. Linus Torvalds
  78. Zach Holman @holman thenounproject.com thanks to:

  79. codingfearlessly.com twitter.com/mmozuras github.com/mmozuras thanks!