• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
GIT: a Gentle InTroduction
 

GIT: a Gentle InTroduction

on

  • 2,271 views

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.

Statistics

Views

Total Views
2,271
Views on SlideShare
2,007
Embed Views
264

Actions

Likes
3
Downloads
0
Comments
0

4 Embeds 264

http://www.codemotion.it 145
http://2011.codemotion.it 109
http://codemotion.it 9
http://codemotion.macaronilab.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    GIT: a Gentle InTroduction GIT: a Gentle InTroduction Presentation Transcript

    • GIT: (a) Gentle InTroduction! Bruno Bossola
    • Agenda
      • About version control
      • Concepts
      • Working locally
      • Remote operations
      • Enterprise adoption
      • Q&A
    • Hey dude who are ya??
      • 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
    • About version control Picture courtesy of globalnerdy.com All rights kindly reserved
    • Centralized SCM
      • CVS
      • SVN
      Picture courtesy of progit.org. All rights kindly reserved
    • Distributed SCM
      • Git
      • Mercurial
      • Bazaar
      Picture courtesy of progit.org. All rights kindly reserved
    • Concepts
    • Concepts
      • Snapshots, not deltas
      • Nearly every operation is local
      • Integrity is a priority
      • The “three states”
    • Snapshot, not deltas
      • Deltas are maintained: CVS, SVN, Bazaar
      Picture courtesy of progit.org. All rights kindly reserved
    • Snapshot, not deltas
      • Full file is maintained: Git , BitKeeper
      Picture courtesy of progit.org. All rights kindly reserved
    • Most operations are local
      • 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 :)
    • Integrity is a priority
      • Everything in Git is check-summed
        • SHA-1 hash
        • 40-character string such as 95b87297210672b16bb70ded20626c9c551ccd58
      • It's impossible to make a change without Git knowing it!
      • Git generally only adds data
    • The three states
      • modified
      • staged
      • committed
      • all local operations!
      Picture courtesy of progit.org. All rights kindly reserved
    • Quick demo!
      • Installing
      • Initializing a local repository
      • Managing files
      • Looking into history
    • Local operations
    • How does it work
      • Git has an internal object database
      • It contains
        • blob (files)
        • commit
        • tree
        • …and other stuff :)
    • After a commit... Picture courtesy of progit.org. All rights kindly reserved
    • After three commits... Picture courtesy of progit.org. All rights kindly reserved
    • A branch is a pointer Picture courtesy of progit.org. All rights kindly reserved
    • Creating a branch Picture courtesy of progit.org. All rights kindly reserved
        > git branch testing
    • HEAD
      • HEAD: a special pointer so Git knows where you are
      Picture courtesy of progit.org. All rights kindly reserved
    • 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'
    • 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'
    • Switch to master
      • Git moves back HEAD to point to master
      Picture courtesy of progit.org. All rights kindly reserved
        > git checkout master
    • 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!'
    • 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(-)
    • Remote operations
    • What's a remote?
      • You can have multiple remote repos
        • usually one, “origin”
        • sometimes one main r/w, other r/o,
        • rarely multiple
      • Collaborating means pushing and pulling data from the remote repos
    • Using a remote: clone
      • Move into an empty folder...
        • Different protocols are available
          • git (native)
          • http(s)
          • ssh
      • You get a full copy of the repository
        > git clone <url>
    • (less usual) Add a remote
      • Move into an existing git folder...
      • Mostly used when working with multiple repositories
        > git remote add <name> <url>
    • Initial clone Picture courtesy of progit.org. All rights kindly reserved
    • How do it syncs?
      • “master” is tracked automatically
      • “fetch” command will download all the updates from the remote db
        • “merge” to merge the branches
        • “rebase” (let's see this later)
      • “pull” is a shortcut for fetch + merge
    • I do some work... Picture courtesy of progit.org. All rights kindly reserved
    • Someone else pushes! Picture courtesy of progit.org. All rights kindly reserved
    • Synchronize with fetch Picture courtesy of progit.org. All rights kindly reserved
    • What next?
      • Fetch is just fetching all the data, nothing changes
      • To update your master copy to the remote you may:
        • Merge
        • Rebase
      • You can have done a pull (fetch + merge)
    • Merge!
      • Git uses an automatic three-ways merge algorithm very efficient :)
      • Most of the time it's a piece of cake
      • Any conflict not resolved automarically must be resolved... by you (as usual!)
    • Rebase!
      • First removes from the target branch the diverging commits
      • Then adds all the changes committed on the source other branch
      • Then adds your commits on top
    • Rebase! After a rebase,,, Picture courtesy of progit.org. All rights kindly reserved
    • Rebase!
      • No differences in result
      • Much cleaner history
      • Branches are then easy to integrate to the master
    • Quick demo!
      • Cloning a repo
      • Fetching from a remote
      • Merging and rebasing
    • Enterprise adoption
    • Issues in the enterprise?
      • No security out of the box
        • secure protocols are based on OS services
        • no way to restrict the access to a repository
        • no way to lock a branch
        • no audit
        • you can commit in behalf of someone else
    • More issues in the enterprise!
      • No easy setup for users and groups
      • administration is a pain (again based on the OS services)
      • Only basic repository visualization (and nothing on the remote)
    • Solutions?
      • use a predefined solution on top of a *nix environment
        • gitolite
        • gitosis
      • get an industrialized service
        • gitenterprise (yeah, the plug, finally!)
        • github-fi
        • …not much more here :)
    • Questions?
    • Thanks!