Git之pull后回退版本

Git  

执行git pull后想恢复到上版本的代码

  1. 查看历史记录
    1. git reflog
    git reflog
    b593214 (HEAD -> test, origin/test) HEAD@{0}: pull: Fast-forward
    7eefb06 HEAD@{1}: reset: moving to HEAD@{3}
    1a87e6e HEAD@{2}: pull: Fast-forward
    845daf9 HEAD@{3}: pull: Fast-forward
    2fa9694 HEAD@{4}: pull: Fast-forward
    7eefb06 HEAD@{5}: pull: Fast-forward
    cfa4c0f HEAD@{6}: pull: Fast-forward
    d3bb39f HEAD@{7}: pull: Fast-forward
    aeea515 HEAD@{8}: pull: Fast-forward

2.回退版本

  1. git reset --hard HEAD@{3}

上面{3}里面的3是reflog中的。



评论 0

发表评论

Top