reverting" a forced git push

This question already has an answer here:

  • Git: Recover deleted (remote) branch 7 answers
  • How to move HEAD back to a previous location? (Detached head) 3 answers

  • Read the full answer provided here:

    How to move HEAD back to a previous location? (Detached head)


    The best way is to use the git reflog to recover your changes

    git reflog

    git reflog will display any change which updated the HEAD and checking out the desired reflog entry will set the HEAD back to this commit.

    Every time the HEAD is modified there will be a new entry in the reflog

    git reflog
    git checkout HEAD@{...}
    

    This will get you back to your desired commit

    在这里输入图像描述

    So checkout your local reflog to find out the desired commit you wish to revert to and then checkout out and branch (again read the attached full answer how to do it)


    I recovered my data using this tutorial,

    http://effectif.com/git/recovering-lost-git-commits

    Thanks everyone for the answers.

    链接地址: http://www.djcxy.com/p/18810.html

    上一篇: 如何撤消几个Git命令?

    下一篇: 恢复“强制性的git推动