git reset --hard error after git rebase abort: warning: log for ref HEAD unexpectedly ended on DD/MM/YYY TTTT
git reset --hard error after git rebase abort: warning: Log for ref HEAD unexpectedly ended on DD/MM/YYY TTTT
在 --abort
之后是否可以还原和恢复 git rebase
操作?
我在以下 rebase 输出后做了一个 git rebase --abort
:
On branch feature/cool-feature-x
Last commands done (20 commands done):
pick bd4c3q commitA
pick e53wr1 commitB
(see more in file .git/rebase-merge/done)
Next commands to do (7 remaining commands):
pick ws5b4 update
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'feature/cool-feature-x' on 'as34y5'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
git log:
按预期给了我一个较旧的提交。说最后一次提交,即 last-working-commit
git reflog
具有预期的所有历史记录。我想使用 HEAD{2}
git reset --hard HEAD{2}
我做的最后一次更改给了我这个:
warning: Log for ref HEAD unexpectedly ended on Sun, 5 Jun 2018 16:15:19
+0300 (last time I made the changes before `git rebase --abort`)
然而last-working-commit
还是一样。每次我 运行 相同的命令,我都会在 log
中得到多个 last-working-commit
参考问题:
Undoing a git rebase
Git: how to undo merge during rebase
编辑:
git reset
似乎在警告之后仍然有效。它每次都创建相同的最后一次提交,但在切换回我最初在 rebase
上进行的分支后,HEAD 实际上已按我的意愿重置。我不知道它为什么会这样,并且有那个警告。
如您所见,此警告不会阻止重置工作。
它(警告信息“warning: Log for ref HEAD unexpectedly ended on...
”)来自refs.c#write_pseudoref()
test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
test $D = $(cat o) &&
test "warning: Log for ref $m unexpectedly ended on $ld." = "$(cat e)"
这意味着,在某一时刻 Git 在重置时正在检查 HEAD 的日志,并认为该日志是它引用的前一个分支的 "past the end of the (reset) history"。
重置完成后,我希望 git 日志再次连贯(使用新的 "end of history")
在 --abort
之后是否可以还原和恢复 git rebase
操作?
我在以下 rebase 输出后做了一个 git rebase --abort
:
On branch feature/cool-feature-x
Last commands done (20 commands done):
pick bd4c3q commitA
pick e53wr1 commitB
(see more in file .git/rebase-merge/done)
Next commands to do (7 remaining commands):
pick ws5b4 update
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'feature/cool-feature-x' on 'as34y5'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
git log:
按预期给了我一个较旧的提交。说最后一次提交,即 last-working-commit
git reflog
具有预期的所有历史记录。我想使用 HEAD{2}
git reset --hard HEAD{2}
我做的最后一次更改给了我这个:
warning: Log for ref HEAD unexpectedly ended on Sun, 5 Jun 2018 16:15:19
+0300 (last time I made the changes before `git rebase --abort`)
然而last-working-commit
还是一样。每次我 运行 相同的命令,我都会在 log
last-working-commit
参考问题: Undoing a git rebase
Git: how to undo merge during rebase
编辑:
git reset
似乎在警告之后仍然有效。它每次都创建相同的最后一次提交,但在切换回我最初在 rebase
上进行的分支后,HEAD 实际上已按我的意愿重置。我不知道它为什么会这样,并且有那个警告。
如您所见,此警告不会阻止重置工作。
它(警告信息“warning: Log for ref HEAD unexpectedly ended on...
”)来自refs.c#write_pseudoref()
test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
test $D = $(cat o) &&
test "warning: Log for ref $m unexpectedly ended on $ld." = "$(cat e)"
这意味着,在某一时刻 Git 在重置时正在检查 HEAD 的日志,并认为该日志是它引用的前一个分支的 "past the end of the (reset) history"。
重置完成后,我希望 git 日志再次连贯(使用新的 "end of history")