-----
# Custom
isHidden: false
menupriority: 1
kind: article
date: 2009-11-12T11:39:54+02:00
title: Git for n00b
multiTitle:
fr: Git pour quoi faire ?
en: Git for what?
-----
# en:[Git][git] for what?
begindiv(intro)
If you just want to use [Git][git] **immediately**, just read dark part. You read this part later to understand correctly foundations of version systems and not doing strange things.
enddiv
[Git][git] is a DCVS, which means a Decentralized Concurrent Versions System. Let's analyze each part of this long term:
### Versions System
Firstly, versions system manage files.
When somebody work with files without a versions system, the following happens frequently:
When you modify a somehow critical file you don't want to loose. You copy naturally this file with another name. For example:
$ cp fichier_important.c fichier_important.c.bak
In consequence of what, the new file, play the role of *backup*. If you break everything, you can always return in the last state by overwriting your modifications.
Of course, this method is not very professional and is a bit limited. If you make many modifications, you'll end with many files with strange names like:
Cthulhu
Shubniggurath
Yogsototh
Say Alex is home and modify the file:
Cthulhu
Shubniggurath
Soggoth
Yogsototh
after that he send the file on the project server. Then on the server there is the Alex file:
A bit later, Beatrice who had not get the Alex file on the server make the modification:
Cthulhu
Dagon
Shubniggurath
Yogsototh
Beatrice send her file on the server
Alex modification is *lost*. One more time, versions system are here to help.
A version system would had *merge* the two files at the time Beatrice send the file on the server. And like by magic, on the server the file would be:
Cthulhu
Dagon
Shubniggurath
Soggoth
Yogsototh
In real life, at the moment Beatrice want to send her modifications, the versions system alert her a modification had occurred on the server. Then she uses a command which pull the modification from the server to her local computer. And this command update her file. After that, Beatrice send again the new file on the server.
begindiv(black)
**In what Concurrent Versions System help?**
- récupérer sans problème les modifications des autres ;
- envoyer sans problème ses modifications aux autres ;
- permet de gérer les conflits. Je n'en ai pas parlé, mais quand un conflit arrive (ça peut arriver si deux personnes modifient la même ligne avec deux contenus différents), les SVC proposent leur aide pour les résoudre. J'en dirai un mot plus loin.
- permet de savoir qui a fait quoi et quand
- get without any problem others modifications,
- send without any problem its own modifications to others,
- manage conflicts. I didn't speak about it, but sometimes a conflict can occur (when two different people modify the same line on a file for example). SVC help to resolve such problem. More on that later,
- help to know who done what and when.
enddiv
### decentralized
This word became popular only recently about CVS. And it mainly means two things:
First, until really recently (SVN), you'll have to be connected to the distant server to get informations about a project. Like get the history. New decentralized systems work with a local *REPOSITORY* (directory containing backups and many informations linked to the versions system functionalities). Hence, one can view the history of a project without the need of being connected.
All instances of a project can live *independently*.
To be more precise, DCVS are base on the *branch* notion.
Practically, it has great importance. It means, everybody work separately, and the system help to glue all their work.
It is even more than just that. It help to code independently each feature and bug fixes. Under other system it was far more difficult.
Typical example:
> I develop my project. I'm ameliorating something. An urgent bug is reported.
>
> With a DCVS I can easily, get back to the version with the bug. Fix it. Send the fix. Get back to my feature work. And even, use the fix for the new version with my new feature.
>
> In a not decentralized version system, doing such a thing is possible but not natural. Decentralization means it become natural to use a branch for each separable work.
begindiv(black)
**Advantages given by DCVS: **
- Ability to work offline,
- Ability to create many *atomic* patches,
- Help the maintenance of many different versions of the same application.
enddiv
## To resume
Let's resume what we can easily do with DCVS:
**Versions Systems**
- back in time,
- list differences between versions,
- name some versions to refer to them easily
- show history of modifications
**Concurrent**
- get others modifications,
- send its modifications to others,
- know who done what and when,
- conflicts management.
**Decentralized**
- Easily manipulate branches
Now let's see how to obtain all these things easily with [Git][git].
[git]: http://git-scm.org "Git"