Your SlideShare is downloading. ×
0
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
GIT: a Gentle InTroduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

GIT: a Gentle InTroduction

2,198

Published on

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

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,198
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×