我无法git rebase --interactive了 [英] I can't git rebase --interactive anymore
问题描述
我在尝试在仓库上执行git rebase --interactive
时遇到严重问题.我收到了神秘的错误fatal: ref HEAD is not a symbolic ref
,我的变基不再起作用.我必须git rebase --abort
才能恢复良好状态.
I'm having a serious problem trying to do git rebase --interactive
on my repo. I get the cryptic error fatal: ref HEAD is not a symbolic ref
, and my rebase ceases to function. I must git rebase --abort
to get back to a good state.
这是我收到的输出: https://gist.github.com/d38f1e2d2ec9bc480b6f
我过去被告知这是由于我处于分离式HEAD"模式,但是如果我处于那种模式,那么我将如何首先进入rebase ?我当然可以从master
开始,然后运行git rebase --interactive
,然后将git-rebase-todo文本文件修改为所需的内容.然后会发生此错误.
What I've been told in the past is that this is due to the fact that I'm in "detached HEAD" mode, but how would I have gotten into the rebase in the first place if I was in that mode? I'm most certainly starting in master
, then running git rebase --interactive
and modifying the git-rebase-todo text file to what I want. And then this error happens.
我已经问过这里的每个人,还有在freenode上@ @git的人.似乎没有人真正了解我的问题或知道解决方案是什么.谷歌搜索该错误不会产生任何结果,有关StackOverflow的相关搜索也没有发现任何结果.我似乎无法弄清楚,从压榨我推送到主控的每个提交到现在将我所做的每个小更改都作为自己的单独提交,这真的很me脚.
I've asked everyone here at work, and some people @ #git on freenode. No one seems to truly understand my problem or know what the solution is. Googling for that error produced nothing, relevant searches on StackOverflow have proven nothing. I can't seem to figure this out, and it's really lame going from squashing every commit I push to master to now pushing every little change I make as its own separate commit.
推荐答案
在'git rebase'期间,检出了基于您的基准的ref.如果引用是提交,那么您将获得独立的头脑;如果它是分支引用,则将该分支检出.如果在提交过程中发生了致命故障,那么您将处于工作状态,处于无聊状态.例如,如果您在Foo分支上,并且尝试根据Bar重新设置基准,那么在发生致命故障后,您将在Bar或Bar之后的某个位置应用了一些基准提交.您只需简单地签出Foo就可以恢复.
During a 'git rebase' the ref that you are rebasing off of is checked out. If that ref is a commit then you will get a detached head; if it is a branch reference then that branch is checked out. If during the course of a commit a FATAL occurs, then you are left with a working directory in a munged state. For example, if you were on branch Foo and you tried to rebase off of Bar, then after a FATAL you will be at Bar or somewhere after Bar with a few rebase commits applied. You recover by checking out Foo as simply.
git rebase --abort
,或者,如果确实扎根了基础(请参阅下面的参考资料),则为:
or, if the rebase is really wedged (see reference below), as:
git checkout -f Foo
在那之后,您可以安全地再次尝试重新设置基准,以尝试调试发生致命故障的原因. 此处是内存不足而无法重新设置基准并且'git rebase --abort'无法正常工作的情况.
After that, you can safely try the rebase again to try to debug why the FATAL occurs. Here is a case where rebase fails when running out of memory and 'git rebase --abort' doesn't work.
这篇关于我无法git rebase --interactive了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!