Git
What git is?
git is a distributed version control system.
And svn, cvs compared to what advantage?
svn, csv centralized version control system. The need for a total warehouse to store, when you need to do a rollback and other operations may put other people's code messed up or lost. The git is that each terminal can be a warehouse. You are free to operate in their own end, and then only needs to merge with others, you need to select. In doing rollback and other operations will not affect the others.
git installation
Installation under Linux system
Enter the command to check whether to install git
git
If not, you can use the command
sudo apt-get install git // This command requires system for the Ubuntu Linux system, if this command is not available, download extract the installation git Linux version
Install windows system
1, the official website for download from the git git installation package for installation
When you see git bash right in the installation is successful
// PS: Look at the file command cat xxx.txt
2, is provided and email username as identification of the machine
// config --golbal means that all of this warehouse will be used to configure git config --global user.name "your name" git config --global user.email "Email @ Email" // run git bash entered in the directory project as compared to using the project configuration git config user.name "gitlab's the Name" git config user.email "[email protected]" // view the current configuration of the project in the list of git config --list
Create Repository
Where you want to be the repository to create a new folder
git commands
// Create a folder
mkdir testgit
// into the directory
cd testgit
// view the directory path Note: It is best not to put Chinese directory
PWS
// directory will become the repository
git init
Add files into the repository.
All version control system can control text files, binary files can not control the track, only to know whether the binary file changes, the changes can not know where, word is a binary file, so the word can not be tracked.
Try not to use Windows system Notepad to edit.
// registration into the git git add xx.txt // submit documents to the warehouse git commit -m "comment"
Status and modify the contents of a file to view commit history
// Check the status of files git git status // Check modify the content git diff // View Submitted history git log