git log
Switching branches: (Note 1)
git checkout branch_name
Local fallback:
git reset --soft commitID
This command only removes the commit log after the specified commitID, while keeping the changes made to the code.
Or
git reset --hard commitID
This command completely removes the changes made after the specified commitID, effectively reverting the code back to its previous state.
Synchronize the remote repository: (note 2)
git push origin HEAD --force
*(Note 1) Git prompts you to commit or stash your changes before switching branches. If you attempt to switch to another branch without committing your changes, you will be prompted with the message "Please commit your changes or stash them before you switch branches". However, if you haven't finished developing the features of your current branch yet, committing may feel incomplete. In this case, you can use the "git stash" command to hide the modified but uncommitted code. This will revert the code to the state of the last commit without showing the modified code. When you return to the branch you were working on, you can use the "git stash pop" command to restore the hidden code.
(Note 2) If you encounter the error "fatal: unable to access 'https://github.com/xxxxx/xxxxxxx.git/': OpenSSL SSL_read: Connection was reset, errno 10054", it may be due to the server's SSL certificate not being signed by a third-party. To resolve this issue, you can disable SSL verification by typing git config --global http.sslVerify "false"
in Git Bash before attempting the operation again.*