Top Banner
Intro Basics VCS Cheat sheets Basics of Version Control Systems Lars Vilhuber 1 1 Cornell University, Economics Department, August 20-22, 2018: Day 2 Vilhuber Basics of VCS
36

Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Mar 22, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Basics of Version Control Systems

Lars Vilhuber1

1Cornell University, Economics Department,

August 20-22, 2018: Day 2

Vilhuber Basics of VCS

Page 2: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

What are VCS

Software development perspectiveVersion control systems (VCS) (or Source ConfigurationManagement (SCM) systems ∗) allow developers or authors tokeep track of the history of their projects? source code. [source]

Generic viewDetailed mechanism to manage different versions (historical,parallel) of documents, files, programs, etc.

Vilhuber Basics of VCS

Page 3: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

What are VCS

Software development perspectiveVersion control systems (VCS) (or Source ConfigurationManagement (SCM) systems ∗) allow developers or authors tokeep track of the history of their projects? source code. [source]

Generic viewDetailed mechanism to manage different versions (historical,parallel) of documents, files, programs, etc.

Vilhuber Basics of VCS

Page 4: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

You already have it

Implicit uses

I Backup systems (Apple Time Machine, others)I Word processors (Undo feature, Track changes in Word,

finer-grained features in content management systems:Google Docs, Blog software, etc.)

I Versioning filesystemsI Paper books!

Vilhuber Basics of VCS

Page 5: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Modern Labor Economics: Theory and Public Policy

Vilhuber Basics of VCS

Page 6: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Modern Labor Economics: Theory and Public Policy

Vilhuber Basics of VCS

Page 7: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Principal idea

1 First edition

4 Second edition5 Start of work on a

Canadian edition6 Start of work on the next

US edition9 Third edition

10 First Canadian edition

Vilhuber Basics of VCS

Page 8: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Principal idea

1 First edition4 Second edition

5 Start of work on aCanadian edition

6 Start of work on the nextUS edition

9 Third edition10 First Canadian edition

Vilhuber Basics of VCS

Page 9: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Principal idea

1 First edition4 Second edition5 Start of work on a

Canadian edition

6 Start of work on the nextUS edition

9 Third edition10 First Canadian edition

Vilhuber Basics of VCS

Page 10: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Principal idea

1 First edition4 Second edition5 Start of work on a

Canadian edition6 Start of work on the next

US edition

9 Third edition10 First Canadian edition

Vilhuber Basics of VCS

Page 11: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Principal idea

1 First edition4 Second edition5 Start of work on a

Canadian edition6 Start of work on the next

US edition9 Third edition

10 First Canadian edition

Vilhuber Basics of VCS

Page 12: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Principal idea

1 First edition4 Second edition5 Start of work on a

Canadian edition6 Start of work on the next

US edition9 Third edition

10 First Canadian edition

Vilhuber Basics of VCS

Page 13: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

File-system based versioning

The most common method... Also used in email versioning...

Remember this?01 01 readBLS.R

02 01 readCensus.R

02 02 prepareCensus.R

03 01 create analysis data.R

04 01 runOLS.sas

README.txt

Vilhuber Basics of VCS

Page 14: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

File-system based versioning

The most common method... Also used in email versioning...

What if I make changes?

01 01 readBLS.R

02 01 readCensus.R

02 02 prepareCensus.R

03 01 create analysis data.R

04 01 runOLS.sas

README.txt

02 01 readCensus.R.bak

02 01 readCensus V2.R

02 01 readCensus V3.R

02 01 readCensus V3-jma.R

02 01 readCensus V3-jma-rm.R

Vilhuber Basics of VCS

Page 15: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

File-system based versioning

The most common method... Also used in email versioning...

What if I make changes?

01 01 readBLS.R

02 01 readCensus.R

02 02 prepareCensus.R

03 01 create analysis data.R

04 01 runOLS.sas

README.txt

02 01 readCensus.R.bak

02 01 readCensus V2.R

02 01 readCensus V3.R

02 01 readCensus V3-jma.R

02 01 readCensus V3-jma-rm.R

Vilhuber Basics of VCS

Page 16: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

File-system based versioning

The most common method... Also used in email versioning...

What if I make changes?

01 01 readBLS.R

02 01 readCensus.R

02 02 prepareCensus.R

03 01 create analysis data.R

04 01 runOLS.sas

README.txt

02 01 readCensus.R.bak

02 01 readCensus V2.R

02 01 readCensus V3.R

02 01 readCensus V3-jma.R

02 01 readCensus V3-jma-rm.R

Vilhuber Basics of VCS

Page 17: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

File-system based versioning

The most common method... Also used in email versioning...

What if I make changes?

01 01 readBLS.R

02 01 readCensus.R

02 02 prepareCensus.R

03 01 create analysis data.R

04 01 runOLS.sas

README.txt

02 01 readCensus.R.bak

02 01 readCensus V2.R

02 01 readCensus V3.R

02 01 readCensus V3-jma.R

02 01 readCensus V3-jma-rm.R

Vilhuber Basics of VCS

Page 18: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

File-system based versioning

The most common method... Also used in email versioning...

What if I make changes?

01 01 readBLS.R

02 01 readCensus.R

02 02 prepareCensus.R

03 01 create analysis data.R

04 01 runOLS.sas

README.txt

02 01 readCensus.R.bak

02 01 readCensus V2.R

02 01 readCensus V3.R

02 01 readCensus V3-jma.R

02 01 readCensus V3-jma-rm.R

Vilhuber Basics of VCS

Page 19: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

File-system based versioning

The most common method... Also used in email versioning...

What if I make changes?

01 01 readBLS.R

02 01 readCensus.R

02 02 prepareCensus.R

03 01 create analysis data.R

04 01 runOLS.sas

README.txt

02 01 readCensus.R.bak

02 01 readCensus V2.R

02 01 readCensus V3.R

02 01 readCensus V3-jma.R

02 01 readCensus V3-jma-rm.R

Vilhuber Basics of VCS

Page 20: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Better way

Is there a better way?

Vilhuber Basics of VCS

Page 21: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

History

Vilhuber Basics of VCS

Page 22: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Two major types of version-management

Centralized modelServer-client approach, editors check out a copy, modify it, andcheck it back in. Multiple editors:I File locking: only one person can check out any given fileI Version merging: discrepancies are handled upon checkin

Distributed modelThere is no central server (prescribed by software). Everyeditor has a full copy of all version, synchronisation occurs byexchanging patches.

Vilhuber Basics of VCS

Page 23: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Two major types of version-management

Centralized modelServer-client approach, editors check out a copy, modify it, andcheck it back in. Multiple editors:I File locking: only one person can check out any given fileI Version merging: discrepancies are handled upon checkin

Distributed modelThere is no central server (prescribed by software). Everyeditor has a full copy of all version, synchronisation occurs byexchanging patches.

Vilhuber Basics of VCS

Page 24: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Focus in this class

We will focus on Git:I Subversion (centralized) - still broadly in use, but no longer

supported at CornellI Git (decentralized) - Hautahi

Windows TortoiseGit (free)OSX installed (Xcode) upon first useLinux typically integrated

with various semi-specialized graphical versions (Githubclient, etc.)

Vilhuber Basics of VCS

Page 25: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

THE reference for Git

git-scm.com/book/en/v2

Vilhuber Basics of VCS

Page 26: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Learning more

Numerous resources on the webI https://try.github.io/

I https://www.atlassian.com/git/tutorials

Vilhuber Basics of VCS

Page 27: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking history

What happened? And who did what?One of the key advantages of using version control systems is... to control versions.I Straightforward to view multiple versions of a file

(assuming proper usage)I Possibility to view who changed what (“blame” or

“annotate”)

Vilhuber Basics of VCS

Page 28: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking using web interfaces: SVN

Vilhuber Basics of VCS

Page 29: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking using web interfaces: SVN

Vilhuber Basics of VCS

Page 30: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking using web interfaces: SVN

Vilhuber Basics of VCS

Page 31: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking using web interfaces: SVN

Vilhuber Basics of VCS

Page 32: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking using web interfaces: git

Vilhuber Basics of VCS

Page 33: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking using web interfaces: git

Vilhuber Basics of VCS

Page 34: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

Tracking using web interfaces: git

Vilhuber Basics of VCS

Page 35: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

VCS infrastructure

At CornellCornell Sourceforge (obsolete as of Sept 30, 2018)

ElsewhereI GitHub (Git, subversion, free for open-source and

academic users)I BitBucket (Git, no subversion, free for academic users)I Roll your own: no server required for Git on your PC

Vilhuber Basics of VCS

Page 36: Basics of Version Control Systems · What are VCS Software development perspective Version control systems (VCS) (or Source Configuration Management (SCM) systems ) allow developers

Intro Basics VCS Cheat sheets

I Git command-line cheat sheetI Xcode cheat sheet (for Mac users)

Vilhuber Basics of VCS