You are on page 1of 20

ICOT-P on ICT Bayabas Group

Introduction to Version Control with

Getting Started

Getting Started

You will learn

Some background on version control systems


Understand why Git is around and why you should use it
Installing Git into your system
Running and using Git

Getting Started

History Tracking

Getting Started

Collaborative Work

Getting Started

What is Version Control?


Version control is a system that records changes to a file or set
of files over time so that you can recall specific versions later.

Getting Started

Why should I use Version Control?

As a programmer, it is very wise to use a VCS


because it allows you to

Getting Started

see the entire history of your project

Getting Started

compare changes over time

Getting Started

See who last modified something that might be causing a problem


See who introduced an issue and when, and more.
Facilitates collaborative changes
and using a VCS also means that if you screw things up or lose files,
you can generally recover easily.

Getting Started

Types of Version Control

Getting Started

Copy and Paste


Many peoples version-control method of choice is to copy files into another
directory
This approach is very common because it is so simple, but it is also
incredibly error prone. It is easy to forget which directory youre in and
accidentally write to the wrong file or copy over files you dont mean to.

Getting Started

Centralized Version Control Systems

CVCS have a single server that


contains all the versioned files
and a number of clients that
check out files from that central
place.
Examples
CVS, Subversion, and
Perforce

Getting Started

Centralized Version Control Systems

The Problem
If the hard disk the central database is on becomes corrupted you lose
absolutely everythingthe entire history of the project except
whatever single snapshots people happen to have on their local
machines.

Getting Started

Distributed Version Control Systems


This is where Distributed Version
Control Systems step in.
In a DVCS, clients dont just check out
the latest snapshot of the files: they
fully mirror the repository.
Examples
Git and Mercurial

Getting Started

Basic Git Workflow


Three main sections of a Git project
1. the Git directory
2. the working directory
3. and the staging area.

Getting Started

Basic Git Workflow


1. You modify files in your working
directory.
2. You stage the files, adding
snapshots of them to your staging
area.
3. You do a commit, which takes the
files as they are in the staging area
and stores that snapshot
permanently to your Git directory.

Getting Started

Installing Git
Installing Git on Windows is very easy. The msysGit project has
one of the easier installation procedures.

Getting Started

First Time Git Setup


IDENTITY
The first thing you should do when you install Git is to set your user
name and e-mail address.
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

Getting Started

CHECKING YOUR SETTINGS


If you want to check your settings, you can use the git config
command to list all the settings Git can find at that point:
$ git config --list
user.name=Scott Chacon
user.email=schacon@gmail.com
color.status=auto
color.branch=auto
...

You can also check what Git thinks a specific keys value is by
typing git config {key}:
$ git config user.name
Scott Chacon

--list

Getting Started

Summary
You should have a basic understanding of what Git is and how
its different from the CVCS.
You should also now have a working version of Git on your
system thats set up with your personal identity.
Its now time to learn some Git basics.

You might also like