2016/01/12 start learning git: How the version is rolled back

Source: Internet
Author: User
Tags version control system

Local version Library E:\learngit

So the Learngit folder is the workspace

Learngit folder. The git/folder is a repository: contains a staging area (stage) and a pointer to master (head)

The Master branch is unique, you can add the workspace's file git add to Staging area multiple times, and then one-time git commit commits staging area modification

####### #版本的回退其实就是head指针的指向变化, the version has been

1. Modify Readme.txt again to make 3 versions available

Version 1:wrote a Readme file

is a version control system.Git is free software.

Version 2:add distributed

is a distributed version control system.Git is free software.

Version 3:append GPL

is a distributed version control system.Git is free software distributed under the GPL.

2. Learn how to fallback from version 3 to version 2

Git log view version history

You can also use git log--pretty=oneline to briefly output

The last version is, the last version HEAD^ is HEAD^^ , of course, 100 versions of the 100 ^ are relatively easy to count, so write HEAD~100 .

git reset --hard HEAD^

2. How to fallback from version 2 to version 3

git provides a command git reflog to keep track of every single command you make.

Find the commit ID for version 3

git reset--hard commit_id

#####################################################

Working area and staging area---to write

2016/01/12 start learning git: How version fallback

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.