shell
8061035 HEAD@{0}: reset: moving to 8061035 15d526a HEAD@{1}: reset: moving to 15d526ab987063e1a65a04cd429391a573154529 8061035 HEAD@{2}: reset: moving to 8061035b57357aa9bd144197c8170b6a4c7b91ff cb71ccd HEAD@{3}: reset: moving to cb71ccdec184e641af4a792e6ac4aef25b5d14df 8061035 HEAD@{4}: commit: 增加文章评论表单
原因是我发现我commit错了,然后就执行了git reset --hard cb71ccdec184e641af4a792e6ac4aef25b5d14df
,执行之后发现没有回退到cb71ccdec184e641af4a792e6ac4aef25b5d14df
,但是我的代码不知道跑到那个版本去了。。。(抱歉我现在精神混乱,此处就省略1万字了)
说了这么多,那么问题来了,看代码都看的出来,我用了3次git reset --hard xx
了,我怎么才能回到8061035
呢(8061035 HEAD@{0}: reset: moving to 8061035
我已经用过一次,没回去成功!)?
滿天的星座2017-04-28 09:06:44
The last change to your current 8061035 version is: commit: Add article comment form. You probably don’t mean to go back to this version.
If you want to go back to the 8061035 version
in the first step
First use git log to see how many versions there are between the current version and the 8061035 version you want to roll back.
It is assumed here that there are
Nversions
Try:
git reset --hard HEAD~N+1
If there are too many versions and are cluttered, simply use sourceTree software and import the project into the software. You can clearly view each version and changes. You can also choose the version you want to roll back to.
習慣沉默2017-04-28 09:06:44
First use git log to check the current version number, then git status to check the code modifications, git stash to temporarily save the current modifications, then check the code to see if it is correct, and then try the method above