git learning notes

Distributed Version Control System

Simply speaking ,it helps to record every change in files and make it possiable for a group of people woking together on one file.

Differences between a centralized version control system and a distributed version control system.The biggest problem of a centralized version control system is that it needs network connections.Version libraries are centralized on central servers.Before modifing the files, the newest version should be downloaded.Distributed version do not have a central server.Every single computer is a version libraries.

Ubuntu 18.04 installing git

1
sudo apt-get install git

Windows installing git

It could be downloaded from official website

Repository

All files in repository could be administrated by git.

Steps on creating a version library

1
2
3
4
$mkdir rockets
$cd rockets
$pwd
pwd is used to display the current directory.In Windows make sure not use Chinese in the repository's name.
1
2
$git init
Initialized empty Git repository in ...

Use this step to change this directory into a repository which could be administrated by git.It tells that an empty repository has been created.

Now create a file named first.txt ,add some words in it,like this:

1
2
Git is a version contral system.
Git is a free software.

Ways to add a file to a repository

1
$git add first.txt
1
$git commit -m"wrote a first file"