GIT: (a) Gentle InTroduction! Bruno Bossola
Agenda <ul><li>About version control
Concepts
Working locally
Remote operations
Enterprise adoption
Q&A </li></ul>
Hey dude who are ya?? <ul><li>Developer since 1988
XP Coach during 2k
Co-founder and coordinator of JUG Torino
Java Champion since 2005
Manager at Gitenterprise.com
Working as contractor across Europe </li></ul>
About version control Picture courtesy of  globalnerdy.com All rights kindly reserved
Centralized SCM <ul><li>CVS
SVN </li></ul>Picture courtesy of  progit.org.  All rights kindly  reserved
Distributed SCM <ul><li>Git
Mercurial
Bazaar </li></ul>Picture courtesy of  progit.org.  All rights kindly  reserved
Concepts
Concepts <ul><li>Snapshots, not deltas
Nearly every operation is local
Integrity is a priority
The “three states” </li></ul>
Snapshot, not deltas <ul><li>Deltas are maintained: CVS, SVN, Bazaar </li></ul>Picture courtesy of  progit.org.  All right...
Snapshot, not deltas <ul><li>Full file is maintained:  Git , BitKeeper </li></ul>Picture courtesy of  progit.org.  All rig...
Most operations are local <ul><li>Your local database contains a full copy of the remote(s)
Browsing, changing, search happens locally
Almost everything doable without network
the db is a nice, separate .git folder :) </li></ul>
Integrity is a priority <ul><li>Everything in Git is check-summed </li><ul><li>SHA-1 hash
40-character string such as  95b87297210672b16bb70ded20626c9c551ccd58 </li></ul><li>It's impossible to make a change witho...
Git generally only adds data </li></ul>
The three states <ul><li>modified
staged
committed
all local  operations! </li></ul>Picture courtesy of  progit.org.  All rights kindly  reserved
Quick demo! <ul><li>Installing
Initializing a local  repository
Managing files
Looking into history </li></ul>
Local operations
How does it work <ul><li>Git has an internal object database
It contains </li><ul><li>blob (files)
commit
tree
…and other stuff :) </li></ul></ul>
Upcoming SlideShare
Loading in...5
×

GIT: a Gentle InTroduction

2,216

Published on

La presentazione di Bruno Bossola in occasione del Codemotion del 5 marzo 2011 http://www.codemotion.it

Un'introduzione all'uso di GIT, il nuovo sistema di controllo versione che sta diventando rapidamente il punto di riferimento per lo sviluppo FLOSS e nell'Enterprise. Durante l'intervento saranno spiegate le principali caratteristiche di GIT , integrandole con dimostrazioni pratiche live che spiegheranno il funzionamento dei comandi principali. La parte finale della presentazione sarà legata alle problematiche relative all'adozione dello strumento in ambiente enteprise.

Published in: Technology, Sports
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,216
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

GIT: a Gentle InTroduction

  1. 1. GIT: (a) Gentle InTroduction! Bruno Bossola
  2. 2. Agenda <ul><li>About version control
  3. 3. Concepts
  4. 4. Working locally
  5. 5. Remote operations
  6. 6. Enterprise adoption
  7. 7. Q&A </li></ul>
  8. 8. Hey dude who are ya?? <ul><li>Developer since 1988
  9. 9. XP Coach during 2k
  10. 10. Co-founder and coordinator of JUG Torino
  11. 11. Java Champion since 2005
  12. 12. Manager at Gitenterprise.com
  13. 13. Working as contractor across Europe </li></ul>
  14. 14. About version control Picture courtesy of globalnerdy.com All rights kindly reserved
  15. 15. Centralized SCM <ul><li>CVS
  16. 16. SVN </li></ul>Picture courtesy of progit.org. All rights kindly reserved
  17. 17. Distributed SCM <ul><li>Git
  18. 18. Mercurial
  19. 19. Bazaar </li></ul>Picture courtesy of progit.org. All rights kindly reserved
  20. 20. Concepts
  21. 21. Concepts <ul><li>Snapshots, not deltas
  22. 22. Nearly every operation is local
  23. 23. Integrity is a priority
  24. 24. The “three states” </li></ul>
  25. 25. Snapshot, not deltas <ul><li>Deltas are maintained: CVS, SVN, Bazaar </li></ul>Picture courtesy of progit.org. All rights kindly reserved
  26. 26. Snapshot, not deltas <ul><li>Full file is maintained: Git , BitKeeper </li></ul>Picture courtesy of progit.org. All rights kindly reserved
  27. 27. Most operations are local <ul><li>Your local database contains a full copy of the remote(s)
  28. 28. Browsing, changing, search happens locally
  29. 29. Almost everything doable without network
  30. 30. the db is a nice, separate .git folder :) </li></ul>
  31. 31. Integrity is a priority <ul><li>Everything in Git is check-summed </li><ul><li>SHA-1 hash
  32. 32. 40-character string such as 95b87297210672b16bb70ded20626c9c551ccd58 </li></ul><li>It's impossible to make a change without Git knowing it!
  33. 33. Git generally only adds data </li></ul>
  34. 34. The three states <ul><li>modified
  35. 35. staged
  36. 36. committed
  37. 37. all local operations! </li></ul>Picture courtesy of progit.org. All rights kindly reserved
  38. 38. Quick demo! <ul><li>Installing
  39. 39. Initializing a local repository
  40. 40. Managing files
  41. 41. Looking into history </li></ul>
  42. 42. Local operations
  43. 43. How does it work <ul><li>Git has an internal object database
  44. 44. It contains </li><ul><li>blob (files)
  45. 45. commit
  46. 46. tree
  47. 47. …and other stuff :) </li></ul></ul>
  48. 48. After a commit... Picture courtesy of progit.org. All rights kindly reserved
  49. 49. After three commits... Picture courtesy of progit.org. All rights kindly reserved
  50. 50. A branch is a pointer Picture courtesy of progit.org. All rights kindly reserved
  51. 51. Creating a branch Picture courtesy of progit.org. All rights kindly reserved <ul>> git branch testing </ul>
  52. 52. HEAD <ul><li>HEAD: a special pointer so Git knows where you are </li></ul>Picture courtesy of progit.org. All rights kindly reserved
  53. 53. Switching to a branch <ul><li>Git moves HEAD pointer to the branch pointer </li></ul>Picture courtesy of progit.org. All rights kindly reserved <ul>> git checkout testing Switched to branch 'testing' </ul>
  54. 54. Change a file (on a branch) <ul><li>Git keeps following with HEAD the branch pointer </li></ul>Picture courtesy of progit.org. All rights kindly reserved <ul>> vi readme.txt > git commit -a -m 'readme file updated' </ul>
  55. 55. Switch to master <ul><li>Git moves back HEAD to point to master </li></ul>Picture courtesy of progit.org. All rights kindly reserved <ul>> git checkout master </ul>
  56. 56. And change again! <ul><li>Git still keeping separate pointers to the branches </li></ul>Picture courtesy of progit.org. All rights kindly reserved <ul>> vi readme.txt > git commit -a -m 'readme file now rocks!' </ul>
  57. 57. Time to merge! <ul><li>A new “merge” commit is generated </li></ul>Picture courtesy of progit.org. All rights kindly reserved <ul>> git merge testing Merge made by recursive. 1 files changed, 1 instions(+), 0 dltions(-) </ul>
  58. 58. Remote operations
  59. 59. What's a remote? <ul><li>You can have multiple remote repos </li><ul><li>usually one, “origin”
  60. 60. sometimes one main r/w, other r/o,
  61. 61. rarely multiple </li></ul><li>Collaborating means pushing and pulling data from the remote repos </li></ul>
  62. 62. Using a remote: clone <ul><li>Move into an empty folder... </li><ul><li>Different protocols are available </li><ul><li>git (native)
  63. 63. http(s)
  64. 64. ssh </li></ul></ul><li>You get a full copy of the repository </li></ul><ul>> git clone <url> </ul>
  65. 65. (less usual) Add a remote <ul><li>Move into an existing git folder...
  66. 66. Mostly used when working with multiple repositories </li></ul><ul>> git remote add <name> <url> </ul>
  67. 67. Initial clone Picture courtesy of progit.org. All rights kindly reserved
  68. 68. How do it syncs? <ul><li>“master” is tracked automatically
  69. 69. “fetch” command will download all the updates from the remote db </li><ul><li>“merge” to merge the branches
  70. 70. “rebase” (let's see this later) </li></ul><li>“pull” is a shortcut for fetch + merge </li></ul>
  71. 71. I do some work... Picture courtesy of progit.org. All rights kindly reserved
  72. 72. Someone else pushes! Picture courtesy of progit.org. All rights kindly reserved
  73. 73. Synchronize with fetch Picture courtesy of progit.org. All rights kindly reserved
  74. 74. What next? <ul><li>Fetch is just fetching all the data, nothing changes
  75. 75. To update your master copy to the remote you may: </li><ul><li>Merge
  76. 76. Rebase </li></ul><li>You can have done a pull (fetch + merge) </li></ul>
  77. 77. Merge! <ul><li>Git uses an automatic three-ways merge algorithm very efficient :)
  78. 78. Most of the time it's a piece of cake
  79. 79. Any conflict not resolved automarically must be resolved... by you (as usual!) </li></ul>
  80. 80. Rebase! <ul><li>First removes from the target branch the diverging commits
  81. 81. Then adds all the changes committed on the source other branch
  82. 82. Then adds your commits on top </li></ul>
  83. 83. Rebase! After a rebase,,, Picture courtesy of progit.org. All rights kindly reserved
  84. 84. Rebase! <ul><li>No differences in result
  85. 85. Much cleaner history
  86. 86. Branches are then easy to integrate to the master </li></ul>
  87. 87. Quick demo! <ul><li>Cloning a repo
  88. 88. Fetching from a remote
  89. 89. Merging and rebasing </li></ul>
  90. 90. Enterprise adoption
  91. 91. Issues in the enterprise? <ul><li>No security out of the box </li><ul><li>secure protocols are based on OS services
  92. 92. no way to restrict the access to a repository
  93. 93. no way to lock a branch
  94. 94. no audit
  95. 95. you can commit in behalf of someone else </li></ul></ul>
  96. 96. More issues in the enterprise! <ul><li>No easy setup for users and groups
  97. 97. administration is a pain (again based on the OS services)
  98. 98. Only basic repository visualization (and nothing on the remote) </li></ul>
  99. 99. Solutions? <ul><li>use a predefined solution on top of a *nix environment </li><ul><li>gitolite
  100. 100. gitosis </li></ul><li>get an industrialized service </li><ul><li>gitenterprise (yeah, the plug, finally!)
  101. 101. github-fi
  102. 102. …not much more here :) </li></ul></ul>
  103. 103. Questions?
  104. 104. Thanks!

×