Git usage - GitHub project rollback version

View historical version

Use git logthe command to view the historical version of the project:

image-20230828222124481

You can keep pressing Enter until you find the historical version you want, and copy committhe following string id.

Restore historical version

Execute command git reset --hard 版本号:

 git reset --hard 39ac3ea2448e81ea992b7c4fdad9252983dca2fe

Push to remote main branch

git push origin main --force

Make sure your branch names match.

Guess you like

Origin blog.csdn.net/m0_63230155/article/details/132549653