1. 程式人生 > >git 執行pull錯誤如何撤銷

git 執行pull錯誤如何撤銷

錯誤 for commit mov git pull ref log strategy ade

比如你當前所在的空間是trunk,但是執行了git pull origin branches,這時需要回滾回去,可以用一下步驟:

1、運行git reflog命令查看你的歷史變更記錄,如下:

69fd1684 HEAD@{13}: commit: bug修復
6cc9dd2a HEAD@{14}: pull origin v2.8.0: Fast-forward
9f7483ab HEAD@{15}: pull origin v2.8.0: Merge made by the ‘recursive‘ strategy.
1ad219e4 HEAD@{16}: commit: bug修復
3a894700 HEAD@{17}: commit: bug修復
b50c0828 HEAD@{18}: pull origin v2.8.0: Merge made by the ‘recursive‘ strategy.
9a4267c5 HEAD@{19}: commit: bug修復
9aa718bd HEAD@{20}: commit: bug修復
ea89ffde HEAD@{21}: pull origin v2.8.0: Fast-forward
13c328ea HEAD@{22}: checkout: moving from master to v2.8.0


2、然後用git reset --hard HEAD@{n},(n是你要回退到的引用位置)回退。

比如上圖可運行 git reset --hard 9f7483ab

git 執行pull錯誤如何撤銷