GIT: a Gentle InTroduction

  • 2,125 views
Uploaded 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.

More in: Technology , Sports
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,125
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
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
    • About version control
    • 3. Concepts
    • 4. Working locally
    • 5. Remote operations
    • 6. Enterprise adoption
    • 7. Q&A
  • 8. Hey dude who are ya??
    • 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
  • 14. About version control Picture courtesy of globalnerdy.com All rights kindly reserved
  • 15. Centralized SCM Picture courtesy of progit.org. All rights kindly reserved
  • 17. Distributed SCM Picture courtesy of progit.org. All rights kindly reserved
  • 20. Concepts
  • 21. Concepts
    • Snapshots, not deltas
    • 22. Nearly every operation is local
    • 23. Integrity is a priority
    • 24. The “three states”
  • 25. Snapshot, not deltas
    • Deltas are maintained: CVS, SVN, Bazaar
    Picture courtesy of progit.org. All rights kindly reserved
  • 26. Snapshot, not deltas
    • Full file is maintained: Git , BitKeeper
    Picture courtesy of progit.org. All rights kindly reserved
  • 27. Most operations are local
    • 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 :)
  • 31. Integrity is a priority
    • Everything in Git is check-summed
      • SHA-1 hash
      • 32. 40-character string such as 95b87297210672b16bb70ded20626c9c551ccd58
    • It's impossible to make a change without Git knowing it!
    • 33. Git generally only adds data
  • 34. The three states Picture courtesy of progit.org. All rights kindly reserved
  • 38. Quick demo!
    • Installing
    • 39. Initializing a local repository
    • 40. Managing files
    • 41. Looking into history
  • 42. Local operations
  • 43. How does it work
    • Git has an internal object database
    • 44. It contains
  • 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
      > git branch testing
  • 52. HEAD
    • HEAD: a special pointer so Git knows where you are
    Picture courtesy of progit.org. All rights kindly reserved
  • 53. Switching to a branch
    • Git moves HEAD pointer to the branch pointer
    Picture courtesy of progit.org. All rights kindly reserved
      > git checkout testing Switched to branch 'testing'
  • 54. Change a file (on a branch)
    • Git keeps following with HEAD the branch pointer
    Picture courtesy of progit.org. All rights kindly reserved
      > vi readme.txt > git commit -a -m 'readme file updated'
  • 55. Switch to master
    • Git moves back HEAD to point to master
    Picture courtesy of progit.org. All rights kindly reserved
      > git checkout master
  • 56. And change again!
    • Git still keeping separate pointers to the branches
    Picture courtesy of progit.org. All rights kindly reserved
      > vi readme.txt > git commit -a -m 'readme file now rocks!'
  • 57. Time to merge!
    • A new “merge” commit is generated
    Picture courtesy of progit.org. All rights kindly reserved
      > git merge testing Merge made by recursive. 1 files changed, 1 instions(+), 0 dltions(-)
  • 58. Remote operations
  • 59. What's a remote?
    • You can have multiple remote repos
      • usually one, “origin”
      • 60. sometimes one main r/w, other r/o,
      • 61. rarely multiple
    • Collaborating means pushing and pulling data from the remote repos
  • 62. Using a remote: clone
    • Move into an empty folder...
      • Different protocols are available
    • You get a full copy of the repository
      > git clone <url>
  • 65. (less usual) Add a remote
    • Move into an existing git folder...
    • 66. Mostly used when working with multiple repositories
      > git remote add <name> <url>
  • 67. Initial clone Picture courtesy of progit.org. All rights kindly reserved
  • 68. How do it syncs?
    • “master” is tracked automatically
    • 69. “fetch” command will download all the updates from the remote db
      • “merge” to merge the branches
      • 70. “rebase” (let's see this later)
    • “pull” is a shortcut for fetch + merge
  • 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?
    • Fetch is just fetching all the data, nothing changes
    • 75. To update your master copy to the remote you may:
    • You can have done a pull (fetch + merge)
  • 77. Merge!
    • Git uses an automatic three-ways merge algorithm very efficient :)
    • 78. Most of the time it's a piece of cake
    • 79. Any conflict not resolved automarically must be resolved... by you (as usual!)
  • 80. Rebase!
    • 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
  • 83. Rebase! After a rebase,,, Picture courtesy of progit.org. All rights kindly reserved
  • 84. Rebase!
    • No differences in result
    • 85. Much cleaner history
    • 86. Branches are then easy to integrate to the master
  • 87. Quick demo!
    • Cloning a repo
    • 88. Fetching from a remote
    • 89. Merging and rebasing
  • 90. Enterprise adoption
  • 91. Issues in the enterprise?
    • No security out of the box
      • 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
  • 96. More issues in the enterprise!
    • 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)
  • 99. Solutions?
    • use a predefined solution on top of a *nix environment
    • get an industrialized service
      • gitenterprise (yeah, the plug, finally!)
      • 101. github-fi
      • 102. …not much more here :)
  • 103. Questions?
  • 104. Thanks!