Git-撤消提交(git reset –soft)什么都不做 [英] Git - undo commit (git reset --soft) does nothing

查看:249
本文介绍了Git-撤消提交(git reset –soft)什么都不做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚进行了一次提交,并且意识到我需要撤消提交而不删除任何更改....我该怎么做?我尝试了git reset --soft,但是什么也没有做,没有错误也没有做,当我输入该命令时,实际上什么也没发生.我在做什么错了?

I just did a commit and realized I need to undo the commit without deleting any changes....how would I do that? I have tried git reset --soft and that did nothing, no errors nothing, when I enter that command, literally nothing happens. What am I doing wrong?

推荐答案

git reset --soft表示HEAD,但是您想返回到之前 HEAD的提交,因此:

git reset --soft implies HEAD, but you want to go back to the commit before HEAD, thus :

git reset --soft HEAD^

这篇关于Git-撤消提交(git reset –soft)什么都不做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆