I managed to create a little mess in my local git repository. I was trying to fix a broken commit by using the following instructions. Before running the "git commit --amend" (and after the git rebase --interactive) I decided that my changes were incorrect and so I executed "git reset HEAD --hard". Not a good idea, I tell you.
现在,交互式基础似乎被"卡住了".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 …Run Code Online (Sandbox Code Playgroud) 我正在运行命令git rebase --continue并收到错误:
error: update_ref failed for ref 'refs/heads/HEAD-feature': cannot lock ref 'refs/heads/HEAD-feature': is at db50dd34de1e90c0616bf9318be489ee8d9a012a but expected 83f09532b2352418c0f562f48929dc504e6a0452 error: could not update refs/heads/HEAD-feature
我查看了几个类似的问题,但没有一个答案有效。
我尝试了以下方法:
1. git update-ref -d refs/remotes/origin/HEAD-feature
2. git --no-optional-locks fetch --prune origin
3. git gc --prune=now
4. git remote prune origin
Run Code Online (Sandbox Code Playgroud)
我发现克服这个问题的唯一方法是这样做git rebase --abort,但随后我会丢失在交互式变基期间所做的所有更改。有任何想法吗?