使用 git pull rebase的命令后发现冲突, 使用 git rebase --abort 处理后, 发现 之前commit到本地的记录全部消失了, 在log中也没有找到, 使用下面的方法解决.
1. 获得操作记录:
git reflog
---
1af8485 (HEAD -> develop2, origin/develop3) HEAD@{0}: pull --rebase origin develop3: Fast-forward
1efa53b HEAD@{1}: checkout: moving from develop2 to develop2
5818922 (origin/develop2, develop2) HEAD@{2}: commit: fix: xxxxxx
afe7ec6 HEAD@{3}: checkout: moving from develop3 to develop3
1efa53b HEAD@{4}: rebase: updating HEAD
afe7ec6 HEAD@{5}: checkout: moving from develop3 to develop2
f2b67e4 HEAD@{6}: commit: feat: xxxxxxx
...
找到要回退消失的提交记录
2. 回退到之前丢失提交的记录
git reset --hard <commit_id>
HEAD is now at f2b67e4 feat: xxxxxxx
这就回退到了, 之前push之前的记录, 重新进行 pull rebase的操作就可以了