1. Getting Started

1.1 About Version Control

Local Version Control Systems
The method of choice is to copy files into another directory (perhaps a time-stamped directory, if they’re clever). This approach is very common because it is so simple, but it is also incredibly error prone.

Centralized Version Control Systems
These systems have a single server that contains all the versioned files, and a number of clients that check out files from that central place.

Distributed Version Control Systems
Every client have fully mirror the repository, including its full history.

1.2 A Short History of Git

A Short History of Git
As with many great things in life, Git began with a bit of creative destruction and fiery controversy.

1.3 What is Git?

Snapshots, Not Differences
These other systems store as a set of files and the changes made to each file over time. this is the Differences.

Nearly Every Operation Is Local
you have the entire history of the project right there on your local disk, most operations seem almost instantaneous.

Git Has Integrity
ou can’t lose information in transit or get file corruption without Git being able to detect it.

Git Generally Only Adds Data
in Git, nearly all of them only add data to the Git database.

The Three States
Git has three main states that your files can reside in: modified, staged, and committed:
Modified means that you have changed the file but have not committed it to your database yet.
Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
Committed means that the data is safely stored in your local database.

The basic Git workflow goes something like this:
You modify files in your working tree.
You selectively stage just those changes you want to be part of your next commit, which adds only those changes to the staging area.
You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.

1.6 Getting Started – First-Time Git Setup

First-Time Git Setup
Git comes with a tool called git config that lets you get and set configuration variables, These variables can be stored in three different places:
[path]/etc/gitconfig file: Contains values applied to every user on the system and all their repositories.
~/.gitconfig or ~/.config/git/config file: Values specific personally to you.
config file in the Git directory (that is, .git/config): Specific to that single repository.
You can view all of your settings and where they are coming from using:

$ git config --list --show-origin