Git common Command collation

Source: Internet
Author: User

Organize your git tutorials from Liaoche

To create an empty directory:

mkdir Learngit

Turn the catalog into a warehouse

$ git init

Add files to the warehouse

$ git Add readme.txt

Submit the file to the warehouse

" wrote a readme file "

View historical records

$ git log

Git version fallback, in Git, to represent the HEAD current version, the previous version is, the last version HEAD^ is, HEAD^^ of course, 100 to 100 of the version is ^ more easy to count, so write HEAD~100 . Fallback version with reset

$ git reset--hard head^

git add remote repository

$ git Remote add origin [email protected]:liuhan703/xxx.git

Push local content to GitHub

$ Git push-u Origin Master

Cloning from a remote repository to a local

$ git clone [email protected]:michaelliao/gitskills.git

Create, switch branches

$ git checkout-b dev

There are two things done in the above sentence, creating a branch, switching to a branch

$ git branch dev$ git checkout dev

Merging branches to master

$ git Merge dev

Git common Command collation

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.