[英]Revert git repo to penultimate commit while ditching last commit
我找到了一些有關如何還原到先前提交的答案,但是每個答案都與我的情況稍有不同。 我想回到過去我剛剛倒數第二次提交的那一刻,好像我的最后一次提交不存在一樣。 我希望這個結果永遠不是暫時的。
在下面的屏幕快照中,如果我要完全銷毀該對象,則是第一次提交。 第二個(“調整后的文字樣式...”)是我要成為的最后一個提交。
只需執行git reset --hard HEAD~1 ,然后推送--force您的遠程分支(如果您已經推送了要刪除的修訂版)。
git reset --hard HEAD~1
[英]Revert git repo to previous commit
[英]How to revert git repo while preserving the commit history?
[英]Git revert last commit in heroku
[英]Delete or Revert git commit in git repo server
[英]Revert last commit for one file and not the whole repo
[英]revert back to last commit in git branch
[英]Git: How to Undo commit *and* revert to last branch
[英]Revert git reset HEAD to last commit changes
[英]How to revert working stage to last commit in git?
[英]safe way to revert git branch to last commit?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.