如何撤消上次提交 [英] How to undo last commit

查看:93
本文介绍了如何撤消上次提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了以下评论

  git add / file1 / path 
git rm / file / path
git commit -mmessage

如何使用git撤销上次提交?



像我不想提交这些文件。

警告:如果您已经按 您想要做:

  git reset HEAD〜

如果你不喜欢不希望更改并将所有内容都删除:

  git reset --hard HEAD〜


I did the following comments

git add /file1/path
git rm /file/path
git commit -m "message"

how do I undo my last commit using git?

Like I don't want to have those files committed.

解决方案

Warning: Don't do this if you've already pushed

You want to do:

git reset HEAD~

If you don't want the changes and blow everything away:

git reset --hard HEAD~

这篇关于如何撤消上次提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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