Vous êtes sur la page 1sur 22

Version Control

By Nathan Bertram
7th / August / 2008
Intro.

Who am I? And what do I do?


Intro.

What is Version Control?


- Version Control lets you track your files over time in a logical manner. Keep
a log of who, when and why changes occurred.
- Often refereed to as Revision Control or Source Control.
Intro.

You use it every day.


And you don’t even know it.

myfile_v4.as myfile_jun08.fla myfile_test02.fla myfile_final.swf


Basic Terminology
Repository (repo) - The database for storing all your files.

Server - Where your repository is stored.

Client - The computer connecting to the repo.

Working Copy / Working Set - Your local directory of files, where you make changes.

Main Trunk - The “primary” location for code in the repo.

Revision - What version a file is on (rev1, rev2, rev3 & etc.).

Head - The latest revision in the repo.


Repository

Client
A
Repository

Client Client Client


C A B
Client Client
D Client
E
F

Repository

Client Client Client


C A B
Client Client
D Client
E
F
Client
I
Client
Repository G

Client Client
J H
Client Client Client
C A B
More Basic Terminology
Add - Put a file into the repo for the first time (begin tracking it with Version Control).

Check Out - Download a file from the repo.

Check In / Commit - Upload a file to the repository (if it has changed). The file gets a
new revision number, and team members can “check out” the latest one.

Update / Sync - Synchronize your files with the latest from the repository. This lets you
grab the latest revisions of all files.

Checkin Message - A short message describing what was changed.

Changelog / History - A list of changes made to a file since it was created

Revert - Throw away your local changes and reload the latest version from the repository.

Status - What files with in your working directory have been modified.
Basic Checkins

Main Trunk

ice cream
hp sauce
Rev. 1

Joe creates list.txt with two lines of text and adds it to the repository he has just set up.
Basic Checkins

Main Trunk

ice cream ice cream


hp sauce bread
Rev. 1 milk
eggs
Rev. 2

Jeff checks out list.txt and edits the file and removes the line “hp sauce” from the file
and adds in “bread”, “milk” and “eggs”. Jeff then checks in the list.txt.
Basic Checkins

Main Trunk

ice cream ice cream ice cream ice cream


hp sauce bread bread bread
Rev. 1 milk milk milk
eggs eggs eggs
Rev. 2 cake Rev. 4
Rev. 3

Each time we check in a new copy a new revision number is set for the file.
A Closer Look

Main Trunk

ice cream Check Out ice cream


hp sauce bread
Rev. 1 milk
eggs
Rev. 2

ice cream
Revert bread Check In
milk
eggs
Working Copy
Intermediate / Advanced Terminology
Diff / Change / Delta - Finding variance between two files.

Branch - Create a separate copy of a file/folder for private use (debugging, experimenting & etc).

Merge / Patch - Apply changes from one file to another, to bring it up to date.

Conflict - When pending changes to a file contradict each other (both changes cannot be applied).

Resolve - Fixing the files that contradict each other and checking in the fixed correct

Locking - “Taking Control” over a file. So that only the owner of the file can edit the file until the
owner has unlocked the file. Used to avoid conflicts in critical phase of file.

Breaking the Lock - Forcibly unlocking a file so that you can edit it. It may be needed if
someone on the team is away.

Tagging - Define your own version number in addition to the revision numbering.
Eg. v1.01, 1.02, 1.03 or v1.0, v1.5, v2.0
Basic Diffs

Main Trunk

ice cream + bread ice cream ice cream


hp sauce + milk bread + cake bread
Rev. 1 + eggs milk milk
- hp sauce eggs eggs
Rev. 2 cake
Rev. 3

Diff / Change / Delta - Finding variance between two files. Many VCS store Diffs
rather than entire copies of the file to save space over multiple versions.
Branching
ice cream ice cream
ice cream
soup soup
hp sauce
rice peanuts
Rev. 2 Rev. 3 Rev. 5

Branch

Main Trunk

ice cream ice cream ice cream ice cream


hp sauce bread bread bread
Rev. 1 milk milk milk
eggs eggs eggs
Rev. 4 cake Rev. 7
Rev. 6

Branching allows us to make a copy of our files in a folder and work with them
separately from the Main Trunk.
Merging
Milk
Milk Eggs
Eggs + Cake Bread
Bread Cake
Rev. 2 Rev. 3

Branch

Main Trunk

Milk Milk Milk


Eggs + Sugar Eggs + Cake Eggs
Bread Bread Bread
Rev. 1 Sugar Sugar
Rev. 4 Cake
Rev. 5

Merging allows you to apply changes from one file to another.


Conflicts!
ice cream
Joe: hp sauce
+ bread
- hp sauce
ice cream
bread
Rev. 1 Conflict

Main Trunk

ice cream
Jane: hp sauce
+ eggs
- hp sauce
ice cream
eggs
Rev. 1 Rev. 2

Conflicts arise when pending changes to a file contract each other. Both changes cannot be
applied. Joe and Jane both check out the file at the same time. Jane is the first check in her
changes. Joe goes to check in his version of the file later in the day. However, a conflict arrises
because in the latest revision in the repository there is no hp sauce to remove!
Resolving Conflicts!
ice cream
Joe: hp sauce
+ bread
- hp sauce
ice cream
bread
Rev. 1 Conflict

Main Trunk

ice cream ice cream


Jane: hp sauce
+ eggs
- hp sauce bread
Rev. 1 milk
eggs
Rev. 2

When conflicts arise it is up to you to check in a newer version that resolves the conflict.
One approach is to sync to the current version of the file and reapply your changes to it.
Key Points.
- Easily keep track of who, when and why changes occurred.
- Your project files are always backed up on a remote server in a repository.
- Easily collaborate on the same code base at any given time.
- Jump back in time an access previous revisions.
- Branch out and develop other features while the main project goes on.
- Take it slow and keep on learning.
Resources.
Good Reads:
betterexplained.com/articles/a-visual-guide-to-version-control/
thinkvitamin.com/features/design/subversion-for-designers
athleticsnyc.com/blog/entry/on-using-subversion-for-web-projects

In-depth Explanation:
http://www.ericsink.com/scm/source_control.html

SVN Free Book:


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

SVN Windows:
http://tortoisesvn.tigris.org/

SVN Mac Apps:


http://www.versionsapp.com/
http://www.apple.com/downloads/macosx/development_tools/svnx.html

Git:
http://www.gitcasts.com/
http://git.or.cz/course/svn.html
www.github.com

Web Apps:
http://www.beanstalkapp.com/
http://springloops.com/
http://cvsdude.com/
http://svnrepository.com/

A few Version Control Systems:


CVS, SVN, GIT, Perforce, Mercurial, Monotone, SVK, Bazaar & Darcs.

Vous aimerez peut-être aussi