在一次rebase的时候,由于手抖,本来--continue输成了--skip,导致之前的commit丢失了…这才找到了git reflog来恢复commit,特此记录下来。
Git reflog
Reference logs, or “reflogs”, record when the tips of branches and other references were updated in the local repository.
reflog是Git操作的数据恢复的重要命令,它能够记录几乎所有本地仓库的改变,包括我们删除的commit记录。一旦我们执行了hard-reset的操作,rebase --skip就是一种,我们的一部分commit通过git log就会找不到,但是这部分都被reflog记录下来,这样我们只需git reflog就能找到之前的commit,并通过git checkout -b tmp commit-sha创建临时分支,最后merge到当前分支就可以恢复到之前的操作。
|
|