Version Control
            Systems
Understanding the differences between centralized and
decentralized version control systems and the options
           of different types of VCS available
Has this ever
           happened?
• You look in the trash for files.
• You have more than two or three levels of
  undo in a document.
• You have emailed someone to send you a
  copy of some files.
• FTP has died mid transfer leaving partial
  files.
What is Version
             Control

• Revision control (also known as version
  control, source control or (source) code
  management (SCM)) is the management of
  changes to documents, programs, and other
  information stored as computer files.*



  *http://en.wikipedia.org/wiki/Revision_control
What is Version
             Control

• Changes are usually identified by a number
  or letter code, termed the "revision
  number", "revision level", or simply
  "revision".



  *http://en.wikipedia.org/wiki/Revision_control
What is Version
             Control

• Each revision is associated with a
  timestamp and the person making the
  change. Revisions can be compared,
  restored, and with some types of files,
  merged.



  *http://en.wikipedia.org/wiki/Revision_control
Types of Version
         Control
• Centralized
 • CVS, Subversion, Perforce etc.
• Distributed
 • GIT, Mercurial, Bazaar
Centralized


•   Needs to be online or
    LAN to repo.
Distributed


•   Do not need to be
    online. No central
    Repo.
People Are Divided

•   “Hey, you can use your old model if you want to. git
    doesn't *force* you to change. But trust me, once
    you start noticing how different groups can have
    their own experimental branches, and can ask
    people to test stuff that isn't ready for mainline yet,
    you'll see what the big deal is all about.”

    Centralized _works_. It's just *inferior*.


    Linus Torvalds in a letter to the KDE team 20 Aug 2007
People Are Divided


•   "Merging is the key to software developer
    collaboration."




    Mark Shuttleworth (Ubuntu / Canonical Ltd.):
People Are Divided


•   "By 2011-2012, I predict this technology will be
    widely adopted and many teams will wonder how
    they once managed without it."




    Ian Clatworthy (Canonical / Bazaar)
People Are Divided

• "Subversion has been
  the most pointless
  project ever started".
  "If you like using CVS,
  you should be in some
  kind of mental
  institution or
  somewhere else".


   Linus Torvalds
What else is there

• Mercurial (hg) and Bazaar (bzr) -
  decentralized. File Revision System not
  Delta Change Systems.
• CVS (dead), Perforce (ask kyle and fletcher)
GIT & SVN
       Copy a Project

• > git clone url
  > git pull
• > svn checkout url
  > svn update
GIT & SVN
 Create a Repository

• > git init
• > create repo
GIT & SVN
    Add to First Repo

• > git add .
  > git commit
• > svn import file://repo
GIT & SVN
    Check Differences

• > git diff
• > svn diff | less
GIT & SVN
         Check Status

• > git status
• > svn status
GIT & SVN
Restore from Revision

• > git checkout path
• > svn revert path
GIT & SVN
  Moves and Changes
• > git add file
  > git rm file
  > git mv file
• > svn add file
  > svn rm file
  > svn mv file
GIT & SVN
         Committing

• > git commit -a
• > svn commit
GIT & SVN
   Reviewing History

• > git commit -a
• > svn commit
GIT & SVN
Tagging and Branching

• > git tag -a name
• > svn copy http://example.com/svn/trunk
  http://example.com/svn/tags/name
GIT & SVN
Tagging and Branching

• > git tag -a name
• > svn copy http://example.com/svn/trunk
  http://example.com/svn/tags/name
GIT & SVN
Tagging and Branching
• > git tag -l
  > git show tag
• > svn list http://example.com/svn/tags/
  > svn log --limit 1 http://example.com/svn/
  tags/tag
GIT & SVN
Tagging and Branching
• > git branch branch
  > git checkout branch
• > svn copy http://example.com/svn/trunk
  http://example.com/svn/branches/branch
  > svn switch http://example.com/svn/
  branches/branch
GIT & SVN
   Changing Branches

• > git merge branch
• > svn merge -r 20:HEAD http://
  example.com/svn/branches/branch
GIT & SVN
    Remote Branches

• > git clone url
• > svn checkout url
GIT & SVN
    Remote Branches

• > git checkout --track -b branch origin/
  branch
• > svn switch url
GIT & SVN
       Cherry Picking

• > git cherry-pick rev
• > svn merge -c rev url
Git GUI

• gitc
• git-gui
• git cola
• gitx
More Information


• http://www.infoq.com/articles/dvcs-guide
• http://git.or.cz/course/svn.html

Version Control Lassosoft 2009 Lasso Developers Conference

  • 1.
    Version Control Systems Understanding the differences between centralized and decentralized version control systems and the options of different types of VCS available
  • 2.
    Has this ever happened? • You look in the trash for files. • You have more than two or three levels of undo in a document. • You have emailed someone to send you a copy of some files. • FTP has died mid transfer leaving partial files.
  • 3.
    What is Version Control • Revision control (also known as version control, source control or (source) code management (SCM)) is the management of changes to documents, programs, and other information stored as computer files.* *http://en.wikipedia.org/wiki/Revision_control
  • 4.
    What is Version Control • Changes are usually identified by a number or letter code, termed the "revision number", "revision level", or simply "revision". *http://en.wikipedia.org/wiki/Revision_control
  • 5.
    What is Version Control • Each revision is associated with a timestamp and the person making the change. Revisions can be compared, restored, and with some types of files, merged. *http://en.wikipedia.org/wiki/Revision_control
  • 6.
    Types of Version Control • Centralized • CVS, Subversion, Perforce etc. • Distributed • GIT, Mercurial, Bazaar
  • 7.
    Centralized • Needs to be online or LAN to repo.
  • 8.
    Distributed • Do not need to be online. No central Repo.
  • 9.
    People Are Divided • “Hey, you can use your old model if you want to. git doesn't *force* you to change. But trust me, once you start noticing how different groups can have their own experimental branches, and can ask people to test stuff that isn't ready for mainline yet, you'll see what the big deal is all about.” Centralized _works_. It's just *inferior*. Linus Torvalds in a letter to the KDE team 20 Aug 2007
  • 10.
    People Are Divided • "Merging is the key to software developer collaboration." Mark Shuttleworth (Ubuntu / Canonical Ltd.):
  • 11.
    People Are Divided • "By 2011-2012, I predict this technology will be widely adopted and many teams will wonder how they once managed without it." Ian Clatworthy (Canonical / Bazaar)
  • 12.
    People Are Divided •"Subversion has been the most pointless project ever started". "If you like using CVS, you should be in some kind of mental institution or somewhere else". Linus Torvalds
  • 13.
    What else isthere • Mercurial (hg) and Bazaar (bzr) - decentralized. File Revision System not Delta Change Systems. • CVS (dead), Perforce (ask kyle and fletcher)
  • 14.
    GIT & SVN Copy a Project • > git clone url > git pull • > svn checkout url > svn update
  • 15.
    GIT & SVN Create a Repository • > git init • > create repo
  • 16.
    GIT & SVN Add to First Repo • > git add . > git commit • > svn import file://repo
  • 17.
    GIT & SVN Check Differences • > git diff • > svn diff | less
  • 18.
    GIT & SVN Check Status • > git status • > svn status
  • 19.
    GIT & SVN Restorefrom Revision • > git checkout path • > svn revert path
  • 20.
    GIT & SVN Moves and Changes • > git add file > git rm file > git mv file • > svn add file > svn rm file > svn mv file
  • 21.
    GIT & SVN Committing • > git commit -a • > svn commit
  • 22.
    GIT & SVN Reviewing History • > git commit -a • > svn commit
  • 23.
    GIT & SVN Taggingand Branching • > git tag -a name • > svn copy http://example.com/svn/trunk http://example.com/svn/tags/name
  • 24.
    GIT & SVN Taggingand Branching • > git tag -a name • > svn copy http://example.com/svn/trunk http://example.com/svn/tags/name
  • 25.
    GIT & SVN Taggingand Branching • > git tag -l > git show tag • > svn list http://example.com/svn/tags/ > svn log --limit 1 http://example.com/svn/ tags/tag
  • 26.
    GIT & SVN Taggingand Branching • > git branch branch > git checkout branch • > svn copy http://example.com/svn/trunk http://example.com/svn/branches/branch > svn switch http://example.com/svn/ branches/branch
  • 27.
    GIT & SVN Changing Branches • > git merge branch • > svn merge -r 20:HEAD http:// example.com/svn/branches/branch
  • 28.
    GIT & SVN Remote Branches • > git clone url • > svn checkout url
  • 29.
    GIT & SVN Remote Branches • > git checkout --track -b branch origin/ branch • > svn switch url
  • 30.
    GIT & SVN Cherry Picking • > git cherry-pick rev • > svn merge -c rev url
  • 32.
    Git GUI • gitc •git-gui • git cola • gitx
  • 33.