Tweet: Https://git-scm.com/book/zh
Tweet: Quick start for git and GitHub
1.git installation (1) Windows
Website: Https://git-scm.com/download/win Download and install
(2) Linux installation
Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel Installation dependent environment
Yum Install git
2. Repository Creation (1) Creating a project directory
mkdir git_test
CD Git_test
(2) Repository creation
git init inch d:/mypython/day26/git_test/.git/
#创建了一个空的git仓库在当前目录下的隐藏目录. Git under
(3) Create a file to add the file to the repository
1. Vim My_first_git_program.txt #创建文件, write some data to it
git status #查看当前工作区状态 On branch Masterno commits yetuntracked files: "git add <file> .... " inch What'll be committed) " git add to track)
3. git add my_first_git_program.txt #将当前文件添加到暂存区
4. git commit-m " Fitst Commit My_first_git_program.txt "#将当前暂存区中的数据全部放入仓库, annotations must be provided
5 in the commit data, it may be necessary for us to fill in the author's mailbox and name, sometimes by default we can use : --global user.email [email protected]git config--global user.name LD To configure global information
Add:
3. Code rollback (1) for our modified file, as long as it is still in the workspace. We can all use it directly.git checkout--file name, restore the data
Add:
For code added to staging area, you cannot use checkout revocation, checkout is just the code for the workspace
(2) For the data we are going to roll back staging area, we can use reset
git reset HEAD readme #将数据从暂存区, rollback to workspace Unstaged changes after reset:m Readme
Add: HEAD
Getting Started with git and GitHub