Git之pull后回退版本
- 开发技术
- 2020-09-17
- 1093
- 0
执行git pull后想恢复到上版本的代码
- 查看历史记录
git refloggit 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.回退版本
git reset --hard HEAD@{3}
上面{3}里面的3是reflog中的。