我上个月开始了我的项目,到目前为止已完成了150次。
我也定期推,我的最后推是今天早上。因此,我的工作并没有完全丢失,但是我想知道是否可以进行本地恢复,以恢复我的上一次提交(在推送之后进行)。
这是怎么回事:
-
今天早上,我还原了两天前的一次提交。 AFAIK,一切顺利。从那以后,我一直在努力工作。
-
今天下午,我意识到我的最后2个提交可以合并。所以我尝试了
git rebase --interactive
。但是Git回答:
I wonder if you are in the middle of another rebase. If that is the
case,please try
git rebase (--continue | --abort | --skip)
If that is not the case,please
rm -fr ".git/rebase-merge"
and run me again. I am stopping in case you still have something
valuable there.
我认为我是由于最近的恢复工作,所以做了git rebase --abort
。我做错了。我几乎所有的提交都消失了,git log仅显示上个月的前3个。我想从那以后我有一个待定的基准。
有没有办法还原该重新设置--abort?
感谢您的阅读和帮助。
编辑:这是git状态:
On branch master
Your branch is behind 'origin/master' by 147 commits,and can be fast-forwarded.
(use "git pull" to update your local branch)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.vscode/
__pycache__/
main.py
venv/
nothing added to commit but untracked files present (use "git add" to track)
编辑:这是git reflog(我想回到f0b2519):
6b634e3 (HEAD -> master) HEAD@{1}: rebase -i (abort): updating HEAD
f0b2519 HEAD@{2}: commit: Add comments in params
da4f6b7 HEAD@{3}: commit: Add comments in params
850ac42 HEAD@{4}: commit: del pygame import in params,adapt main and pygi
3415a2f HEAD@{5}: commit: Put config content in params then delete config
98a8b89 HEAD@{6}: commit: Supress 'if main' in params
72803da (origin/master) HEAD@{7}: checkout: moving from 63cb88ae8d2f1547c7d18882084c06b73d892419 to master
63cb88a HEAD@{8}: checkout: moving from master to branch2
72803da (origin/master) HEAD@{9}: revert: Revert "Move switcher in pgi.press_key()"
3f3ccb6 HEAD@{10}: checkout: moving from branch2 to master
63cb88a HEAD@{11}: checkout: moving from branch2 to branch2
63cb88a HEAD@{12}: revert: Revert "Move switcher in pgi.press_key()"
3f3ccb6 HEAD@{13}: checkout: moving from master to branch2
3f3ccb6 HEAD@{14}: checkout: moving from branch2 to master
3f3ccb6 HEAD@{15}: checkout: moving from master to branch2
3f3ccb6 HEAD@{16}: commit: Update requirements.txt
ccc6845 HEAD@{17}: commit: Edit docstring in pygameinterface
e4632d2 HEAD@{18}: commit: Linting on config and tool
编辑:git reset --hard f0b2519就像一个咒语一样,真是令人欣慰!非常感谢所有人。