最佳答案
我设法在本地git存储库中创建了一个小混乱。我试图通过使用以下说明修复一个损坏的提交。在运行“git commit -amend”之前(在git rebase -interactive之后),我决定我的更改是不正确的,所以我执行了“git reset HEAD -hard”。我告诉你,这不是个好主意。
现在交互性的调整似乎被“卡住”了。Git将当前分支显示为(|REBASE-m)。每个命令(cd .., ls, git rebase…)在我的存储库中给出以下错误:
cat: .git/rebase-merge/head-name:没有这样的文件或目录
以下是git rebase -abort的样子:
$ git rebase --abort
cat: c:/_work/project/src/git/.git/rebase-merge/quiet: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/head-name: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/orig-head: No such file or directory
HEAD is now at 4c737fb Revert "Modified file names"
rm: cannot remove `c:/_work/project/src/git/.git/rebase-merge/done': Permission denied
rm: cannot remove directory `c:/_work/project/src/git/.git/rebase-merge': Directory
not empty
cat: .git/rebase-merge/head-name: No such file or directory
以下是git rebase的结果——继续:
$ git rebase --continue
cat: c:/_work/project/src/git/.git/rebase-merge/prev_head: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/end: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/msgnum: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/onto: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/quiet: No such file or directory
prev_head must be defined
cat: .git/rebase-merge/head-name: No such file or directory
什么好主意吗?我想把情况重置到我开始我深思熟虑的基地重建行动之前的状态。
以下是git log - online如何显示这种情况:
4c737fb Revert "Modified file names"
247ac02 Modified file names
33141e6 Message modifications
10a4a04 Modified db script
这很好。
我使用的是msysgit v1.7.0.2。