Version Control - Emory Universitycengiz/cs540-485-soft-eng-fa14/slides/17-version-control.pdf ·...

Post on 21-Jun-2019

229 views 0 download

transcript

Version Control

CS 370 SE Practicum, Cengiz Günay

(Some slides courtesy of Eugene Agichtein and the Internets)

CS 370, Günay (Emory) Version Control Spring 2014 1 / 15

Agenda

Make-up lecture:

Diagrams useful for your project designsWatch it and do survey by Thursday 3/27

Project milestone:

4/10 functional prototype opens for testing

Other news:

May collect some experienced entrepreneurs/venture capitalists to seeyour projects at the end of semester

Today: Version control

Centralized: Subversion

Distributed: GIT

CS 370, Günay (Emory) Version Control Spring 2014 2 / 15

Agenda

Make-up lecture:

Diagrams useful for your project designsWatch it and do survey by Thursday 3/27

Project milestone:

4/10 functional prototype opens for testing

Other news:

May collect some experienced entrepreneurs/venture capitalists to seeyour projects at the end of semester

Today: Version control

Centralized: Subversion

Distributed: GIT

CS 370, Günay (Emory) Version Control Spring 2014 2 / 15

Agenda

Make-up lecture:

Diagrams useful for your project designsWatch it and do survey by Thursday 3/27

Project milestone:

4/10 functional prototype opens for testing

Other news:

May collect some experienced entrepreneurs/venture capitalists to seeyour projects at the end of semester

Today: Version control

Centralized: Subversion

Distributed: GIT

CS 370, Günay (Emory) Version Control Spring 2014 2 / 15

Agenda

Make-up lecture:

Diagrams useful for your project designsWatch it and do survey by Thursday 3/27

Project milestone:

4/10 functional prototype opens for testing

Other news:

May collect some experienced entrepreneurs/venture capitalists to seeyour projects at the end of semester

Today: Version control

Centralized: Subversion

Distributed: GIT

CS 370, Günay (Emory) Version Control Spring 2014 2 / 15

Why Version Control?

It's a must in today's computing industry

I Mt. Gox, a company that don't use VC and lost almost a billiondollars. . .

I Other painful stories without VC

You can even version control documents, class �les, �nancial �les, . . .

Also called source control, code management, concurrent versioning,revision control, . . .

Advantages:

I Track changes, keep logs of past developmentI Automatic backups/safety netI Concurrent versions: XP vs. Win8I Allows teamwork

CS 370, Günay (Emory) Version Control Spring 2014 3 / 15

Why Version Control?

It's a must in today's computing industry

I Mt. Gox, a company that don't use VC and lost almost a billiondollars. . .

I Other painful stories without VC

You can even version control documents, class �les, �nancial �les, . . .

Also called source control, code management, concurrent versioning,revision control, . . .

Advantages:

I Track changes, keep logs of past developmentI Automatic backups/safety netI Concurrent versions: XP vs. Win8I Allows teamwork

CS 370, Günay (Emory) Version Control Spring 2014 3 / 15

Teamwork on the same codebase: How?Seriously, how?

CS 370, Günay (Emory) Version Control Spring 2014 4 / 15

Teamwork on the same codebase: How?Seriously, how? No control? Overwrite chaos!

CS 370, Günay (Emory) Version Control Spring 2014 4 / 15

Teamwork on the same codebase: How?Seriously, how? Locking

CS 370, Günay (Emory) Version Control Spring 2014 4 / 15

Teamwork on the same codebase: How?Seriously, how? Merging

CS 370, Günay (Emory) Version Control Spring 2014 4 / 15

Each commit/check-in increments version

What is Subversion?

• A centralized version control system

• Not the newest form of configuration management, but easy to use and popular– Founded in 2000– Successor to widely used CVS

• Aka SVNSlide 6

Repository

Centralized version control: Subversion (SVN)

Documentation

http://svnbook.red-bean.com/

Common SVN usage scenario:

1 svn checkout gets working copy from repo

2 Make local changes in working copy

3 svn update gets latest changes from repo to sync

4 svn commit (or checkin) sends your changes to repo

Investigating the past

svn diff shows your changes from last repoversion

svn diff -cX shows changes in version X

svn log [filename] shows all commit logs

Example: How to �nd a bug

1 You have been messing with the code

2 Suddenly you realized you broke the program

3 How do you �nd when was the bug introduced?

4 Hint: Can go back with svn update -rX

Investigating the past

svn diff shows your changes from last repoversion

svn diff -cX shows changes in version X

svn log [filename] shows all commit logs

Example: How to �nd a bug

1 You have been messing with the code

2 Suddenly you realized you broke the program

3 How do you �nd when was the bug introduced?

4 Hint: Can go back with svn update -rX

Investigating the past

svn diff shows your changes from last repoversion

svn diff -cX shows changes in version X

svn log [filename] shows all commit logs

Example: How to �nd a bug

1 You have been messing with the code

2 Suddenly you realized you broke the program

3 How do you �nd when was the bug introduced?

4 Hint: Can go back with svn update -rX

Advanced concepts: tags, branches, and merging

svn tag <name> [-rX] marks a version(e.g., release)

svn copy clones current version as branch

svn merge reintegrates branch to main trunk

1

2

3

4

5

6

7

8

10

9

T1

T2

Trunks

Branches

Merges

Tags

Discontinueddevelopment

branch

CS 370, Günay (Emory) Version Control Spring 2014 9 / 15

Advanced concepts: tags, branches, and merging

svn tag <name> [-rX] marks a version(e.g., release)

svn copy clones current version as branch

svn merge reintegrates branch to main trunk

What is it good for?

Tags for beta test releases, main releases,patches

Branches for experimental development

See the SVN book for more info

1

2

3

4

5

6

7

8

10

9

T1

T2

Trunks

Branches

Merges

Tags

Discontinueddevelopment

branch

CS 370, Günay (Emory) Version Control Spring 2014 9 / 15

Limitations of centralized version control

Tell me!

Obvious: it's centralized! Needs network for:

1 making commits2 getting updates3 inspecting revision history (logs, di�, etc)

What if you're coding on a plane?

I Enter distributed version control

CS 370, Günay (Emory) Version Control Spring 2014 10 / 15

Limitations of centralized version control

Tell me!

Obvious: it's centralized! Needs network for:

1 making commits2 getting updates3 inspecting revision history (logs, di�, etc)

What if you're coding on a plane?

I Enter distributed version control

CS 370, Günay (Emory) Version Control Spring 2014 10 / 15

Limitations of centralized version control

Tell me!

Obvious: it's centralized! Needs network for:

1 making commits2 getting updates3 inspecting revision history (logs, di�, etc)

What if you're coding on a plane?

I Enter distributed version control

CS 370, Günay (Emory) Version Control Spring 2014 10 / 15

Get your own repo!

Can do all VC operations locally now!

Thus you need to clone a repo

Get your own repo!

Can do all VC operations locally now!

Thus you need to clone a repo

So what is local and what is remote?

Local operations (same as previous):

update/commit

tag/branch

log/di�

Remote operations (new concepts):

Pull: Get all changesets fromorigin repo

Push: Send your changesets toorigin

Still has origin repo to communicate between team members

In Git, pull can be divided into fetch+merge (like SVN branch merge)

So what is local and what is remote?

Local operations (same as previous):

update/commit

tag/branch

log/di�

Remote operations (new concepts):

Pull: Get all changesets fromorigin repo

Push: Send your changesets toorigin

Still has origin repo to communicate between team members

In Git, pull can be divided into fetch+merge (like SVN branch merge)

So what is local and what is remote?

Local operations (same as previous):

update/commit

tag/branch

log/di�

Remote operations (new concepts):

Pull: Get all changesets fromorigin repo

Push: Send your changesets toorigin

Still has origin repo to communicate between team members

In Git, pull can be divided into fetch+merge (like SVN branch merge)

We will use Github

We have educational account with private repositories

Open accounts on GitHub and send us your account ids!

Example GitHub project

Git documentation: http://git-scm.com/documentation

History of version control software

Revision Control System (RCS):

Provided ci, co (checkin, checkout) commands underUNIX.Create revisions for each �le invidually

Concurrent Version System (CVS):

Like RCS, but systemic for directoriesCollects revision �les into repos

Subversion (SVN):

Allows renaming directories easilyRevisions not in �les, but kept in database

GIT:

Because somebody called Linus Torvald a git

Developed to keep track of changes in Linux kernel

Others:

Microsoft SourceSafe, Mercurial, . . .

CS 370, Günay (Emory) Version Control Spring 2014 15 / 15