Undo git pull (forced update)

This question already has an answer here:

  • Undo git pull, how to bring repos to old state 7 answers

  • There is no nice way of doing what you want, hence why a force push on git is highly advised against.

    If you have the SHAs for the commits you've lost you can cherry-pick them, even though you can no longer see the commits in git any longer, it will still be able to reference them (I think!). Another option is to find another machine with the old commits on there, cherry-pick the commits you want, revert the commits you don't want and then do another git push -f . (And then try to never do a forced push again!)

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

    上一篇: 从主站删除git pull

    下一篇: 撤消git pull(强制更新)