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
- [[email protected] my]$ git log
- Commit Ff3f2238f33256c9d3436e235c1c34d3b8147fe8
- Merge: 248cba8 944274f
- Author:lixinglei <[email protected]>
- Date:thu Jul 4: +0800
- Demand 3
- Commit 248cba8e77231601d1189e3576dc096c8986ae51
- Author:lixinglei <[email protected]>
- Date:thu Jul 4: +0800
- Demand 2
- Commit 944274f83b945610d1ff08eaabceaad64f161505
- author:lixinglei< [Email protected]>
- Date:thu Jul 4: +0800
- 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
- [[email protected] my]$ git reset--hard 248cba8e77231601d1189e3576dc096c8986ae51
- HEAD is now at 248cba8 demand 2
- [[email protected] my]$ git log
- Commit 248cba8e77231601d1189e3576dc096c8986ae51
- Author:lixinglei <[email protected]>
- Date:thu Jul 4: +0800
- 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