Git is the world's most advanced distributed version control system (no one).
Many people know, Linus created the open-source Linux in 1991. Since then, the development of Linux systems, has become the largest server system software.
Although Linus created Linux, but Linux is to grow by enthusiastic volunteers around the world to participate, so many people write code for Linux around the world, and that Linux code is how to manage it?
………………………………………
Liao Xuefeng always poke the original text of the article
Linus spent two weeks own use C to write a distributed version control system, which is Git!
Create Repository
$ mkdir learngit
$ cd learngit
$ pwd
pwd command displays the current directory.
By git init
command this directory can become a Git repository management
Initialize a Git repository, use git init command.
Add files to the Git repository, in two steps:
- The first step in using the command
git add <file>
, pay attention, it can be used repeatedly to add multiple files; - The second step, use the command
git commit
to complete.
- To keep abreast of the status of the work area, use the
git status
command. - If the git status tells you the file has been modified, you can view content with git diff.
Version rollback
- HEAD points to the current version is the version, therefore, Git allows us to shuttle between the versions of the history, use the command
git reset --hard commit_id
. - Before the shuttle, with the
git log
commit history can be viewed, to determine which version to fall back. - To return to the future, with a
git reflog
view command history in order to determine what you want to return to a future version.
The original text stamp Liao Xuefeng teacher article
In submitting code to the git repository when the need to always monitor the status change:
My operation is as follows:
1, git status
the main check those files has been modified
2, git add -A
to submit a file to the local repository
3, git status
check submission status
4、git commit -m "说明最好见名之意"
5, git pull origin master
first pull other people's code
6, git push origin master
submit code to a remote repository
Original: Large column simply use Git commands Remarks