Introduction to GIT
    Boby - Thenetcircle 2010
Plan

• Basics
• Workflow
• Roadmap
Basics

• What is GIT?
• How does it work?
• Why shall i use GIT?
What is GIT?

• Version control system
• Distributed
• Modern
• Created by Linus Torvald
Distributed?
     • No central repository
     • Mostly local
     • Remote access
                               u1        u3
     Central
                                    u2
u1     u2      u3
                               u4
Modern

• Fast
• Clean
• Rethink of VCS
Usage

• Linux kernel
• Symfony 2
• asOauthPlugin
• Many others on github, gitorious...
How?

• Key-value storage
• File based
• Checksum via SHA-1
• Inside the .git folder
How?




http://progit.org/book/ch1-3.html
How?




http://progit.org/book/ch1-3.html
How?

• Commits are snapshots
• Modified files are copied
• Unmodified files keep the same reference
How?
  Head                                 Head
                     Change file B
Rev 3AB40           Commit changes   Rev 98FD0

  Folder 290FF                         Folder 290FF

    File A 343BA                         File A 343BA
    File B FF0934                        File B 5589A
What about SVN?

• Old, slow, complex
• Merges are a pain!!!
• Merges suck!!!
What about others?


• Mercurial, Bazaar... all distributed VCS
•   The rest (VSS, CVS...)
Basic workflow


• Initialize a repository
• Adding a file
Basic workflow

• Modifying a file
• Viewing the difference
• Committing
What is this add crap?

• The “index” !!!
• Another step in the workflow
• Act as staging area
Basic workflow




http://marklodato.github.com/visual-git-guide/
Basic workflow

• Make 2 modifications on the same file
• Commit the first one
• Commit the second one
Branch workflow

• Create a new branch
• Modify some stuff
• Commit in this branch
Branch workflow


• Merge my new branch back to main
• Commit
Branch workflow

• Modify branch test
• Modify branch master
• Merge
• Solve conflict
Branch workflow

• Modify branch test
• Modify branch master
• Update test from master
Branch workflow
 Master              Branch test

            Branch
Rev 3AB40            Rev 3AB40
Rev AE449            Rev 34E79
Rev CC34F
Branch workflow
 Master              Branch test


Rev 3AB40            Rev 3AB40
Rev AE449            Rev AE449
            Rebase

Rev CC34F            Rev CC34F
                     Rev 34E79
Update your branch from the main =
“git rebase main” =
2 seconds =
Holly crap!!!
 Awesome!!!
Bye bye SVN!!!
Remote workflow

• Checkout a remote branch
• Modify
• Send the modification to the remote
External workflow

• git submodule:
 - longer workflow
 - allows direct co/push
• git subtree
• external dependency manager
Dev workflow
• Clone the main branch
• Create branch for feature
• Commit changes inside
• Rebase often to keep the branch up to date
• Push back
• Tell the maintainer to merge your changes
Main repo




                                                               }
       master
git clone
            git pull      git merge
 git pull
                                                                   remote
                                                                    server

     Boby repo         git checkout -b       Boby repo
      master                                eflower feat




                                                               }
                                       git clone
                                        git pull    git push
                                      git rebase
                                                                     local

                                          Working copy
                                          eflower feat
Roadmap
• Install git
• Training
• Transition with git-svn
• Move all branches/script to git
• End of SVN
• Enjoy!
Installation?

• Version 1.7 of GIT

• CLI
• tortoise git for designer
• Remote repository with Gitorious
Links

• http://progit.org/book/
• http://marklodato.github.com/visual-git-guide/
• http://hginit.com/
• http://git.or.cz/course/svn.html
Questions?

Introduction To Git