Git is a distributed version control system, he used the command-line tool, Github is his website.
Installation Reference:
https://www.liaoxuefeng.com/wiki/896043488029600/896067074338496
Create Repository
Reference link: https: //www.liaoxuefeng.com/wiki/896043488029600/896827951938304
First, create a folder
$ Mkdir learngit $ learngit cd $ pwd / Users / michael / learngit
Git can then become a warehouse management
$ git init Initialized empty Git repository in /Users/michael/learngit/.git/
Then there will be many a .git folder, this folder is used to store management information, someone said to me not to move him
λ ls ah ./ ../ .git /
We may also have to enter a file folder using git init command, this file can also become the repository
Add files to the repository
Version control systems can only track the text file changes, such as TXT files, web pages, all the code, if the binary file when the file, although they would manage, but only to each change of binary files to the series, I do not know how the series of.
Since the text is coded, such as Chinese have frequently used GBK coding, Japanese have Shift_JIS encoding, if there is no problem left over from history, it is strongly recommended to use standard UTF-8 encoding, all languages use the same encoding, neither the conflict, they were all platform support.
Do not use windows notepad to edit text files, because Microsoft developers who will add a hexadecimal string in the beginning of the file, and this will bring a lot of baffling string of problems, such as pages written in HTML when a display will appear at the beginning?
Be sure to put learngit
the directory (subdirectories too), because this is a Git repository, Git worse then put the rest can not find the file.
The first step: command git add
tells Git, to add files to the repository:
C:\Users\Administrator.SC-2012\learngit (master -> origin) λ git add readme.txt C:\Users\Administrator.SC-201\learngit (master -> origin) λ
Implementation of the above command, no display, that's right, Unix philosophy is "no news is good news", indicating successfully added.
The second step, use the command git commit
tells Git, the submission of documents to the repository: (commit: guarantee)
λ git commit -m "creates a readme.txt" # - m is described later in this submission [master (root-commit) b30fedb ] created a the Readme.txt . 1 File changed, 2 insertions (+) # a file is changed, we added two lines to create mode 100644 readme.txt
Why add files Git needs add
, commit
a total of two steps it? Because commit
it can submit many files at once, so you can multiple add
different files, such as:
Git the Add file1.txt [lambda] C: \ Users \ Administrator.SC-201 605 202 132 \ learngit (Master -> Origin) [lambda] # Git the Add file2.txt file3.txt intermediate spaces instead of using a comma C: \ Users \ Administrator.SC -201 605 202 132 \ learngit (Master -> Origin) [lambda] Git the commit -m 'added three files' [Master 06bcd78] 'added three files' . 3 files changed, insertions. 3 (+) Create MODE 100644 file1.txt Create MODE file2.txt 100644 the Create the MODE 100644 file3.txt