比如你当前所在的空间是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