我设法在我的本地 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 –continue 的结果:
$ 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 –oneline 显示情况的方式:
4c737fb Revert "Modified file names" 247ac02 Modified file names 33141e6 Message modifications 10a4a04 Modified db script
这很好。
我正在使用 msysgit v1.7.0.2。
看起来 Git 试图删除该.git/rebase-merge目录但无法完全删除它。您是否尝试过复制该文件夹?.git/rebase- apply如果存在该文件夹,也请复制该文件夹。
.git/rebase-merge
.git/rebase- apply