- Use the " git reset --hard CommitID " command to roll back to the version with the specified CommitID, as shown in the following example command:
git reset --hard 8c38ccaed0c6a7e55aa17e8c730f0f3a9a79ae76
Note: "git reset --hard" is a forced rollback to the previous version or a specific version. This operation is irreversible. Please consider carefully before using it.
- Fall back to the specified commit
git revert [CommitID]
After the rollback operation is completed, perform a forced push to the remote warehouse to update the current remote warehouse version to the actual rollback version. The command is as follows:
git push origin HEAD --force
Note: The "ForcePush" permission needs to be activated when executing the force push command, otherwise the following prompt will pop up:
! [remote rejected] HEAD -> master (TF401027: You need the Git 'ForcePush' permission to perform this action.
Permission settings:
Project Settings >> Repos >> Repositories >> Remote warehouse to set permissions >> Permissions Set Tag, set " Force push (rewrite history, delete branches and tags) " permission to " Allow "