我知道您可以恢复到之前的提交,但听起来历史记录不会消失。如何恢复到之前的提交并确保之后的提交永远消失?
最佳答案
Git reset命令可以实现这一点。
您可以运行git reset --hard
命令恢复到之前的提交。然后运行git push --force
命令清除服务器上此提交之后的所有提交。
git clone <repo_url> #clone your azure git repo to local
git checkout <branch>
git reset --hard <commithash> #revert back to a the previous commit
git push --force #push to remote server
在本地运行上述 git 命令后。您将在 azure devops git 上看到之后的提交都消失了。
关于git - Azure Devops Repos - 恢复到以前的提交,就像最近的提交从未存在过一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65349887/