git 执行pull错误如何撤销

Posted gramblog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git 执行pull错误如何撤销相关的知识,希望对你有一定的参考价值。

比如你当前所在的空间是trunk,但是执行了git pull origin branches,这时需要回滚回去,可以用一下步骤:

1、运行git reflog命令查看你的历史变更记录,如下:

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


2、然后用git reset --hard [email protected]{n},(n是你要回退到的引用位置)回退。

比如上图可运行 git reset --hard 9f7483ab











以上是关于git 执行pull错误如何撤销的主要内容,如果未能解决你的问题,请参考以下文章