Code versioning – An introduction with Git – Different VCS architectures



Code versioning – An introduction with Git – Different VCS architectures

2 0


git-slideshow

Code versioning, an introduction with Git

On Github SkypLabs / git-slideshow

Code versioning

An introduction with Git

By Paul-Emmanuel Raoul / skyper@skyplabs.net / @SkypLabs

What is version control ?

System that records changes to a set of files over time

These systems are called VCS (Version Control Systems)

They are essential for a development project with several people

What can we do with that ?

Keep every version of a file (source code, image ...)

Work easily with several developers

Revert files back to a previous state

Compare changes over time

And much more ...

Different VCS architectures

Local

Centralised

Distributed

Local VCS

Simple local database

No connectivity

No collaboration

Example : RCS

Local VCS

Local VCS - Reference: Pro Git, 2nd edition

Centralised VCS

Made for dealing with the collaboration issue

One single remote server

Requires to know what other people are doing

Examples : CVS, Subversion

Centralised VCS

Centralised VCS - Reference: Pro Git, 2nd edition

Distributed VCS

Full local copy of the remote repository

Can deal with several remote repositories

Several types of workflow

Examples : Git, Mercurial

Distributed VCS

Distributed VCS - Reference: Pro Git, 2nd edition

Why using Git ?

It's fast

Strong support of non-linear development

Ables to handle large projects efficiently

Most VCS used these days

Free and open-source

Git basics

To initialise a Git repository in an existing directory :

git init

And to create a new one :

git init my-project

Git basics

If you want a copy of an existing Git repository :

git clone git@github.com:docker/docker.git

The above command-line will clone the official repository of the Docker project

Git basics

Areas - Reference: Pro Git, 2nd edition

Git basics

To add files to be tracked :

git add *.c
git add include/
git add README.md

These files are now in the staging area

Git basics

And now, your first commit :

git commit -m "first commit"

Git basics

Lifecycle - Reference: Pro Git, 2nd edition

Git branching

Git's "killer feature"

Incredibly lightweight

Designed to be used as often as possible

Basic branching

Basic branching 1 - Reference: Pro Git, 2nd edition

Basic branching

Basic branching 2 - Reference: Pro Git, 2nd edition

Basic branching

Basic branching 3 - Reference: Pro Git, 2nd edition

Basic branching

Basic branching 4 - Reference: Pro Git, 2nd edition

Basic branching

Basic branching 5 - Reference: Pro Git, 2nd edition

Basic branching

Basic branching 6 - Reference: Pro Git, 2nd edition

The rebase feature

Interesting rebase 1 - Reference: Pro Git, 2nd edition

The rebase feature

Interesting rebase 2 - Reference: Pro Git, 2nd edition

The rebase feature

Interesting rebase 3 - Reference: Pro Git, 2nd edition

The rebase feature

Interesting rebase 4 - Reference: Pro Git, 2nd edition

The rebase feature

Interesting rebase 5 - Reference: Pro Git, 2nd edition

Different workflows

Centralised

Integration-manager

Dictator and lieutenant

Centralised

Centralised workflow - Reference: Pro Git, 2nd edition

Integration-manager

Integration-manager workflow - Reference: Pro Git, 2nd edition

Dictator and lieutenant

Dictator and lieutenant workflow - Reference: Pro Git, 2nd edition

Where to host your Git repositories ?

Public clouds

Self-hosted servers

Public clouds

Examples: GitHub, Bitbucked

Git is not GitHub !

Generally free for public repositories

Self-hosted servers

Examples: GitLab, Gogs

Better choice for your confidential works

Common features

Manage privileges

Pull requests / Merge requests

Issues

Wiki

Webhooks

Want to know more about Git ?

Official documentation

Pro Git, 2nd edition

Cheat sheet

Videos

Code versioning An introduction with Git By Paul-Emmanuel Raoul / skyper@skyplabs.net / @SkypLabs