简体   繁体   中英

Revert git repo to penultimate commit while ditching last commit

I found several answers on how to revert to a previous commit but each one is slightly different from my situation. I want to go back in time to the instant where I just committed the penultimate commit, as if my last commit never existed. I want this result permanently not temporarily.

In the screenshot below, the first commit if the one I want to destroy entirely. The second one ("Adjusted text styling...") is the one I want to become my last commit. 在此处输入图片说明

只需执行git reset --hard HEAD~1 ,然后推送--force您的远程分支(如果您已经推送了要删除的修订版)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM