Getting Started with git and GitHub

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.