Lecture8 Version Control Systems Intro

download Lecture8 Version Control Systems Intro

of 18

Transcript of Lecture8 Version Control Systems Intro

  • 8/3/2019 Lecture8 Version Control Systems Intro

    1/18

    Version ControlOr distri uted time machines to create etter software

    Nikhil [email protected]

  • 8/3/2019 Lecture8 Version Control Systems Intro

    2/18

    Software Development Cycle

    Design

    Code

    Test

    Release!(once in a while)

  • 8/3/2019 Lecture8 Version Control Systems Intro

    3/18

    Software Development Cycle

    Scaled by People Time

  • 8/3/2019 Lecture8 Version Control Systems Intro

    4/18

    denny :p

  • 8/3/2019 Lecture8 Version Control Systems Intro

    5/18

    Enter Version Control Systems

    DistributedCentralized

  • 8/3/2019 Lecture8 Version Control Systems Intro

    6/18

    Clones and Checkoutsget your own copy of the code

    With distributed you clone

    Subversion checks out

    svn co https://myawesome.com/pristine/trunk myawesome

    hg clone https://hgbasedproject.org/bazinga/

    git clone https://awesome2.org/awesome2/awesome2.git

  • 8/3/2019 Lecture8 Version Control Systems Intro

    7/18

    Clones vs. CheckoutsIntroduce a little anarchy...

  • 8/3/2019 Lecture8 Version Control Systems Intro

    8/18

    Subversion asideinitial repository creation

    /path/repo||-branches

    |-awesome-1.0.2/`-bazinga-0.5.0/

    |-tags`-trunk

    |-awesome/|-bazinga/

    $ svnadmin create\/path/repo

    +

    a few more steps

  • 8/3/2019 Lecture8 Version Control Systems Intro

    9/18

    Commits

    hg/svn/git commit

    Hack hack hackGit has the concept of a stagingarea which adds better controlon the versioning, and gives morefreedom while editing, but introducesa two step commit process.

    hg has a similar extensions calledcrecord

  • 8/3/2019 Lecture8 Version Control Systems Intro

    10/18

    Revisions

    Way to identify a snapshot of the code

    SVN - 1,2,3,4......1019123....Git/Hg - SHA1 hash eg.

    a954467190e7ab871433e8571da75e1768b6b583

    Special revisions such as HEAD, tip, ORIGIN

  • 8/3/2019 Lecture8 Version Control Systems Intro

    11/18

    Collaboration - push & pull

    ALICE(private)

    ALICE(public)

    master

    BOB(private)

    BOB(public)

    Commit Pull Push

  • 8/3/2019 Lecture8 Version Control Systems Intro

    12/18

    Recovering from mistakesrollbacks and reverts

  • 8/3/2019 Lecture8 Version Control Systems Intro

    13/18

    diff and merge

  • 8/3/2019 Lecture8 Version Control Systems Intro

    14/18

    Usual workflow

    on a nice new dayupdate/pull in changes from others

    see whats new, resolve any conflicts

    work on your feature

    hack hack hackkeep committing atomically

    push to public/central repository

    asend a pull request if you want

    blog about cool new feature

  • 8/3/2019 Lecture8 Version Control Systems Intro

    15/18

    That should keep you occupied forseveral months

    Or - you don't really understand it until you do it.

  • 8/3/2019 Lecture8 Version Control Systems Intro

    16/18

    Good practices

    Commit frequentlyCommit atomically

    Put in good commit messages

    No binary/generated files in the repo

    Never, never, never, never, never,ever break the build

  • 8/3/2019 Lecture8 Version Control Systems Intro

    17/18

  • 8/3/2019 Lecture8 Version Control Systems Intro

    18/18

    That's all Folks!

    Use it for your current project, and every one after thatGet yourself an account on bitbucket.org for HgOr use code.google.com/hosting/ with svn or HgNo point in using Git in college since the ports are blocked

    SVN - subversion.tigris.orgMercurial - mercurial.selenic.comGit - git-scm.org

    The SVN book svnbook.red-bean.comThe Hg book hgbook.red-bean.comThe Git Parable -http://tom.preston-werner.com/2009/05/19/the-git-

    parable.html