AzureDevopsRepos-恢复到以前的提交,就像最近的提交一样从未存在过
我知道你可以恢复到以前的提交,但听起来历史不会消失。如何恢复到之前的提交并确保之后的提交永远消失?
回答
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 上看到之后的提交消失了。
THE END
二维码