Version management artifact Git get started

Source: Internet
Author: User
Tags using git

Since the previous toss over SVN, although ultimately not successful, but also experienced, git get started is relatively simple.

Create an initialization repository in a new directory: Git init

git Add File

git add file2

Git commit-m "Add Files"

git reset--hard head^ (HEAD indicates the latest version, ^ represents the previous version ^^ represents the second version above, head~100 represents the 100th previous)

You can get the version ID given by git reset--hard 89123432来 (SVN has a version ID of 1 2 3 increments, but git is distributed, avoiding a long ID for many different users)

You can view the action and version number of the commit via git log

You can view changes to a file by using git diff file

If you close the window to not remember the ID, you can use Git reflog to view the history and version number of the operation, and then restore the version through the GIT reset--hard ID.

Git checkout--file can restore all actions after git add or git commit

Version management artifact Git get started

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.