git 如何撤销上次提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19303898/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:07:31 来源:igfitidea点击:
How to undo last commit
提问by Kermit the Frog
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?
如何使用 git 撤消上次提交?
Like I don't want to have those files committed.
就像我不想提交这些文件一样。
回答by manojlds
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~