Common git commands and scenarios (2)-online version rollback

Source: Internet
Author: User
Tags git commands
Code After going online, you will encounter problems and bugs. Generally, the most direct thing is to roll back to a previous version: 1. First, use git log to view the version to be rolled back.
 
[Lixinglei @ bogon my] $ git logcommit commit: 248cba8 944274 fauthor: lixinglei <lixinglei@zhangyue.com> date: Thu Jul 4 19:33:55 2013 + 0800 requirement 3 commit: lixinglei <lixinglei@zhangyue.com> date: thu Jul 4 19:33:49 2013 + 0800 requirement 2 commit 944274f83b945610d1ff08eaabceaad64f161505author: lixinglei <lixinglei@zhangyue.com> date: Thu Jul 4 19:33:10 2013 + 0800 requirement 1

2. If you want to roll back to the version of "requirement 2", you can directly use git reset online and use git log to confirm the current version:

[Lixinglei @ bogon my] $ git reset -- hard commit is now at 248cba8 requirement 2 [lixinglei @ bogon my] $ git logcommit commit: lixinglei <lixinglei@zhangyue.com> date: thu Jul 4 19:33:49 2013 + 0800 requirement 2

3. In this way, the code is rolled back to the desired version. If it is online, the service is usually restarted. Of course, there are other methods to roll back. Online is the most practical.

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.