Git common commands and Scenarios (ii)--online version fallback

Source: Internet
Author: User

After the code is online, you will encounter problems, bugs, and usually, the most straightforward is to fall back to a previous version: 1. First use git log to view the version you want to fall back to [Python]View Plaincopy
  1. [[email protected] my]$ git log
  2. Commit Ff3f2238f33256c9d3436e235c1c34d3b8147fe8
  3. Merge: 248cba8 944274f
  4. Author:lixinglei <[email protected]>
  5. Date:thu Jul 4: +0800
  6. Demand 3
  7. Commit 248cba8e77231601d1189e3576dc096c8986ae51
  8. Author:lixinglei <[email protected]>
  9. Date:thu Jul 4: +0800
  10. Demand 2
  11. Commit 944274f83b945610d1ff08eaabceaad64f161505
  12. author:lixinglei< [Email protected]>
  13. Date:thu Jul 4: +0800
  14. Demand 1

2. If you want to fall back to the "Demand 2" version, you can use git reset directly online, using git log to confirm the current version: [Python]View Plaincopy
  1. [[email protected] my]$ git reset--hard 248cba8e77231601d1189e3576dc096c8986ae51
  2. HEAD is now at 248cba8 demand 2
  3. [[email protected] my]$ git log
  4. Commit 248cba8e77231601d1189e3576dc096c8986ae51
  5. Author:lixinglei <[email protected]>
  6. Date:thu Jul 4: +0800
  7. Demand 2

3. In this way, the code will fall back to the desired version, and then, if it is online, it is often necessary to restart the service, of course, there are other ways to fallback, the most practical on the line.

Git common commands and Scenarios (ii)-online 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.