Use git to roll back the code

First you need to use git log to look at the commit ID (the hash value) that you want to fall back to.

Perform a local rollback

Git reset --soft commitID Git reset --hard commitID (Carefully use it, you'd better back up the code before using it, or use Git diff to generate a patch)Copy the code

Rollback of the server

After the local rollback is complete, you need to run the following command to synchronize the remote data:

Git push origin < branch name > git push origin < branch name > Git push origin --force git push origin --force git push originCopy the code

Use TortoiseGit for code rollback

Local rollback

  1. Showlog displays your submission record.

  1. Select the record you want to roll back to, right-click and select Reset This to This Vision. In the dialog box that is displayed, set Reset Type to Hard.

Rollback on the server

If you want to submit the local rollback code to the server and override the server code. Select Push, and select Force Known changes from Options in the dialog box that pops up.