git搞错了,请教下怎么恢复!
黄舟
黄舟 2017-04-28 09:04:44
0
4
474
shell8061035 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我已经用过一次,没回去成功!)?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all (4)
洪涛

Go back: git checkout 8061035; (but this is shown as separated)

    滿天的星座

    The last change to your current8061035version is:commit: Add article comment form. You probably don’t mean to go back to this version.
    If you want to go back to the8061035version
    in the first step First usegit logto see how many versionsthere are between the current version and the8061035versionyou want to roll back. It is assumed here that there are
    NversionsTry:
    git reset --hard HEAD~N+1If 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.

      習慣沉默

      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

        大家讲道理

        Correct answer upstairs. Just checkout.

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!