Git版本回退后再恢复

因版本分支错误,将版本回退到某个版本,但发现期间新建的文件丢失,想撤销本次版本回退,重新回到操作前的状态.

1.通过git reflog命令查看操作日志:

git reflog

2.查看对应的版本号,就可以恢复到任意版本:

dd6e43d (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: pull: Fast-forward
b6786f4 HEAD@{1}: reset: moving to b6786f4af248e0a84351ff6d60d9cd70013e5f16
af24a0b HEAD@{2}: reset: moving to HEAD
af24a0b HEAD@{3}: reset: moving to HEAD
af24a0b HEAD@{4}: reset: moving to HEAD
af24a0b HEAD@{5}: reset: moving to HEAD
af24a0b HEAD@{6}: reset: moving to HEAD
af24a0b HEAD@{7}: commit: add:每周督查表
b6786f4 HEAD@{8}: pull: Fast-forward
5e7ba6a HEAD@{9}: commit: add:每周小组工作汇报模板
39b8d49 HEAD@{10}: pull: Fast-forward
0ccf86d HEAD@{11}: pull: Fast-forward
8c8926a HEAD@{12}: pull: Fast-forward
8f0a825 HEAD@{13}: pull: Fast-forward
699f161 HEAD@{14}: commit: add:科室制度
07c7a3c HEAD@{15}: pull: Fast-forward

3.恢复版本:

git reset --hard "af24a0b"

4.丢失的文件找回.

你可能感兴趣的:(php插件)