我有以下提交:
$ git log --pretty=oneline
ba69c7a4c4a642549e70319ccb1f7904893d6df1 ko added with currentCat and works
63e61d861923694944084e47ed613385d329a36a ko added seperate cat function
ad8be8da63e0381dfeb4a1db108021dd294b0556 init
$
我想回到第二次提交63e6
并删除ba69
提交。我该怎么做呢?
供我参考:
如何显示我的提交内容:
$ git rev-parse HEAD
ba69c7a4c4a642549e70319ccb1f7904893d6df1
$ git show | head -n 5
commit ba69c7a4c4a642549e70319ccb1f7904893d6df1
Author: Your Name <you@example.com>
Date: Wed Feb 3 14:02:32 2016 +1300
ko added with currentCat and works
EDIT1
根据以下评论,重置然后再次提交,这可以在git reflog
$ git reflog
9522fd7 HEAD@{0}: commit: ko add the with to iterate through the currentCat
63e61d8 HEAD@{1}: reset: moving to 63e61
ba69c7a HEAD@{2}: commit: ko added with currentCat and works
63e61d8 HEAD@{3}: commit: ko added seperate cat function
ad8be8d HEAD@{4}: clone: from https://github.com/HattrickNZ/ud989-cat-clicker-ko-starter
答案 0 :(得分:0)
在git reset --hard <commit>
之后,执行git push -f origin
以强制推送并永久删除存储库历史记录中的提交。
如果要将提交保留在repo历史记录中,请使用git revert <commit>
还原您不想要的提交。