本方法需要一个最近提交过的正常分支。
Solution:
- Check out a branch that was recently committed (code that needs to be restored) locally, and then checkout to this branch.
- Compress the required code into a compressed package (in order to replace the code covered by the old code).
- Then go back to the branch where the problem occurred locally
- Unzip the compressed package and replace the code on the problem branch covered by the old code.
- The remote branch creates a new branch, such as the name: recover_old
- Push the code of the local problem branch to the newly created recover_old branch
- Finally, recover_old is merged into the remote master branch. ,that's it
Why create a new recover_old branch?
Because after the branch is merged, if it is wrong, it can be restored to before the merge.