Git Version Control – – What is version control system?



Git Version Control – – What is version control system?

0 0


GIT.Presentation

A Git presentation written on reveal.js

On Github CTS-NL / GIT.Presentation

Git Version Control

Presented by Tim Oram

Created in cooperation with the Computer Technology Society of NL

Presentation on the Git version control system

Why you should use a VCS?

What and why Git?

The basics of using Git?

What is version control system?

For anyone familiar with VCS this may be a bit boring.

Software development workflow

Create

Edit

Save

Repeat

A typical work flow of a software developer.

You may want to know...

Why you made a change?

When you made the change?

What changes were made?

...at any time in the future.

Multiple developers?

Who made the change?

We add the question who made the change.

Early Version Control

The first 10 years of the Linux kernel used tarballs.

You get the when, the what,

but not the why

and tarballs are difficult.

When from the file name.

What from a diff of the contents of the tarballs.

Tar create command can be clumsy.

Diff on two tar balls is painful.

Multiple Developers

You get the who,

but it is very messy

and which version is newer?

History of Git

Developed by Linus Torvalds in 2005

for the linux kernel because

the previous tool they used was no longer available

and everything else sucked.

Why did the others suck?

They were either slow, complicated

did not handle large projects well,

or were not distributed.

Why use Git?

Git is fast!

Has one of the best branching systems.

Fully distributed, no central server.

Local, no network connection required.

Centralized System

  • Commit to server
  • Pull from server
  • History saved on server

Centralized System

Server is required for most operations

Server connection lost?

No version control

Distributed System

Distributed System

Every developer has their own copy

with their own history

to which they can push and pull to others.

Distributed System

Seems confusing, right?

GitHub can act like a central server

The main states

Don't worry if this doesn't make complete sense. It's a high level look.

The main states

Repository

Staging area

Working directory

Repository

The .git directory

Where your history is stored

Where you commit files

Staging area

Where you construct your commit

Layer between you and the repository

Working directory

Current copy of the repository

Actual files and directories

What you use and modify

Basic workflow

Modify files in the working directory

Add files to the staging area

Commit the staging area to the repository

Checkout files from the repository to the working directory

Basic workflow

Git Basics

Getting a repository

git init

Initialize in the current directory

or under the directory provided.

git clone <repository>

Clone in a remote repository.

Status checking

git status

Shows the state of the repository

Staging area

Modified files

Untracked files

Unmodified files

Files Git is tracking but have not been modified

Not shown by git status

Status workflow

Tracking new files

Add a single file

Recursively add folders

Combined

Committing

A basic commit

Commit the contents of your stage to the repository.

Deleting tracked files

Remove a single file

Remove a directory and all the files contained

Also removes the file or folder form the file system.

The status

Unstaging

Remove file from stage

Remove folder from stage

The status

Undoing changes

Checkout a single file

Check out a folder

Status

Does not only work on removed files, also changed files.

Teamwork

Remotes

Hosted on a network

You can have one or many

Collaborate with others by pushing and pulling data

Including the Internet

Working with Remotes

Add a remote

List remotes

Remove remotes

Push to a remote

Pull from a remote

Git Version Control Presented by Tim Oram Created in cooperation with the Computer Technology Society of NL Presentation on the Git version control system